I need some assistance in writing a formula that will provide the sequence in column "A" that restarts for every change in column "B". This is probably very simple, but I just haven't been able to figure it out. Thank you very much for your help!

A B
1 JACK
2 JACK
3 JACK
4 JACK
1 MARY
2 MARY
3 MARY
1 PAUL
2 PAUL