U must have an NOC to join other company, if you dont have then you have to complete 2 year ban starting from date of departure. Has nothing to do with you finishing your 2 year contract with current company.