On sheet2 in B2, put this initial formula, then copy down and across as needed:

=IF(ISNUMBER(MATCH(A2, Sheet1!$A:$A, 0)), INDEX(Sheet1!B:B, MATCH(A2, Sheet1!$A:$A, 0)), "")