I am a resident physician on J1 visa, with my wife in J2 dependent visa in the US since June 2017. On tax return of 2017, I filed as a resident alien, with filing status as married filing jointly. But then I realized later, that for the first 2 years as J1, I should be filing as a nonresident alien. what should I do now for year 2017? And should I file as nonresident alien or resident alien the next year?