I would suggest that the answer is in your question's title - use a pivot table.
The first step would be to create a new column (column C) which provides a counter for the duplicate values in column A.
Then generate a pivot table off columns A:C, with A as row headings, C as column headings and B as data. Probably hide the 'grand totals' too - right click->table options-> uncheck "Grand totals for rows"/"columns"
The formula you use in C could take one of two forms, if the duplicate values in column A are always sequential as in your example, you could use:
C2: =if($A2=$A1,C1+1,1)
which simply increments on the value in the above cell if A has the same value.
But if the duplicate values in Column A may be distributed amongst the whole list (i.e. unsorted) then a more complex (and computationally costly) expression like this can be used:
C2: =countif($A$2:$A2,$A2)
which when filled down the list might make more sense. It counts all occurences of value in column A on the current row above (and including) the current row. e.g. filled down to C10:
C10: =countif($A$2:$A10,$A10)
i.e. "count the occurences of the value in A10 in range A2:A10"
This can get a bit slow for very long lists (i.e. thousands or more) so if sorting is an option, go with the simpler formula.
Cheers!
Rick
Rick 
Melbourne, Australia