if you are on a strict 2-year contract, then it means that you are resigning early which has a somewhat negative thing against you.

But if you have been good with your work and your more than 1 year stay had been fruitful to the company, it will be much easier to negotiate or talk with your management about your inetention.

The worst that you can encounter is BUY your own ticket.  But if you have a one-year renewable contract, then you have the right to go home with your just benefits!