Minimum removal of K equal elements required to empty an array

  
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
  
class GFG {
  
    
    
    
    
    public static void minSteps(
        int[] arr, int N, int K)
    {
        
        
        int count = 0;
  
        
        
        Map cntFreq
            = new HashMap();
  
        for (int i = 0; i < N; i++) {                             cntFreq.put(                 arr[i],                 cntFreq.getOrDefault(                     arr[i], 0)                     + 1);         }                     for (Integer i : cntFreq.keySet()) {                                          if (cntFreq.get(i) % K == 0)                 count += cntFreq.get(i)                          / K;                             else                 count += (cntFreq.get(i)                           / K)                          + 1;         }                              System.out.print(count);     }             public static void main(String[] args)     {         int arr[] = { 4, 4, 7, 3, 1,                       1, 2, 1, 7, 3 };         int N = arr.length;         int K = 5;            minSteps(arr, N, K);     } }