Can someone help me understand how to amend a jointly filed 1040, and file individual 1040-NRs? Do I need to fill two 1040-X?

I filed my taxes jointly with my wife (1040), and recently got to know that we are non-resident aliens and should've filed 1040-NR instead. While I understand that I need to fill 1040-X and 1040-NR, I am not sure how to amend a jointly filed tax return and break that into two 1040-NRs.