From: Charles Williams on
Assuming you data is sorted (or can be sorted) on column A and starts
in Row 2 then you don't need array formulas:

in column C (or somewhere suitable) add a helper column containing
=IF(A2<>A1,COUNTIF(A:A,"="&A2),0)
and fill down
in Column D put
=IF(C2>0,MAX(OFFSET(B2,0,0,C2,1)),D1)
and fill down

If you can Sort Ascending on Column A and Descending on Column B
then you would just need this formula (filled down) in D
=IF(A2<>A1,B2,D1)

regards
Charles