Awk to find duplicates in 2nd field

I want to find duplicates in file on 2nd field i wrote this code:

nawk '{a[$2]++} END{for i in a {if (a>1) print}}' temp

Could not find whats wrong with this.
Appreciate help

Hint: what are trying to 'print'?

awk '{++a[$2]==1}' temp
nawk '{a[$2]++} END{for i in a {if (a>1) print a}}' temp

i am trying to print contents of array

Ah, now you are, but probably you meant to do this instead:

nawk '{a[$2]++} END{for (i in a) if (a>1) print i}' temp

Thankyou