Join data in file1 containing one number per line with data in file2 containing a number and other information per line, keeping the same order as it is found in file1.
join -1 2 -2 1 -a1 <(cat -n file1.txt | sort -k2,2) <(sort file2.txt) | sort -k2 | cut --complement -d" " -f2