Thing is, both for Greece and Spain, probably also for others, the debt as is cannot be paid back. All the earnings of these last few years have gone directly to pay the interests of the debt (barely returning any borrowed money). In Spain the debt is about to reach 100% of the PIB.
Thus the only two paths that I am aware of that have a small chance of maybe possibly allowing them to return something at all are either a renegotiation of the debt (cutting, changing interest, repayment period, etc), or going outside the Euro and using massive depreciation of their currency to try to do so.
The point is not so that they can return less (although that is a necessary part), it is making it so that they can be returned at all. In their current status, they cannot.
The Spanish government even changed the constitution so that the absolute priority for where income of the State goes to is repaying the debt. This leaves already next to no money to do anything else.
I don't know how the situation in Greece is, but I expect it to be along the same lines. So no, I am not surprised that ΣΥΡΙΖΑ won, neither will I be surprised if Podemos (similar lines) does the same in Spain.