All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
The scholars differed in opinion in regard to standing at the right-side of the imaam in prayer on whether it is an obligation or only a recommended act. The view of the majority of the scholars is that it is a Sunnah and that the prayer does not become invalid by not standing at the right-side of the imaam; this is the view favored by Shaykh Ibn ‘Uthaymeen . Based on this view, your prayer is valid and you are not obliged to repeat it, and the prayer of the imam is also valid, Allaah willing.
Allaah knows best.