The general formula is as follows, you can adjust to your needs:
=IF(ROW() - 1 <= COUNTA(A:A)-1, INDEX(A:A, ROW()), INDEX(B:B, ROW() - COUNTA(A:A)+1))