Driver program to test above function
public static void main ( String [ ] args ) { int arr [ ] = { 2 , 2 , 1 , 3 , 1 } ; int k = 2 ; System . out . println ( smallestKFreq ( arr , arr . length , k ) ) ; } }