Can be simplified to:
=XMATCH(A2:A1106*1000+B2:B1106/1000;SORT(A2:A1106*1000+B2:B1106/1000;;-1);0)