Utility Function to remove array elements such that frequency of each distinct array element is at most K
void UtilRemov ( vector < int > & arr , int n , int k ) { arr = RemoveElemArr ( arr , n , k ) ;