I filed 1040 by accident and I was supposed to file 1040nr how do I return money

I am an international student and I sent the wrong form 1040, I received refund money as a result. I found out I have to file 1040NR along with a form 1040X. What should I do with the money I got from filing form 1040? Do I include it as a check, how do I pay it back to the IRS?

 

Thank you for your time