For this Question: Given an array A[] of size N and an integer K. Print the count of distinct numbers in all subarrays of size k in the array A[].The first line of input contains two integers N and K. The next line contains N space separated values of the array A[].

Constraints:-
1 <= N, K <= 100000
1 <= A[] <= 1000000000Print the space separated values denoting counts of distinct numbers in all subarrays of size k in the array A[].Sample Input :
7 4
1 2 1 3 4 2 3

Sample Output:
3 4 4 3

Explanation:-`
First window's elements is:- 1 2 1 3 which contains 3 different elements.
Second window's elements is:- 2 1 3 4 which contains 4 different elements.
Third window's elements is:- 1 3 4 2 which contains 4 different elements.
Fourth window's elements is:- 3 4 2 3 which contains 3 different elements., I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {

        public static void main (String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String str[] = br.readLine().trim().split(" ");
        int n = Integer.parseInt(str[0]);
        int k = Integer.parseInt(str[1]);
        str = br.readLine().trim().split(" ");
        int arr[] = new int[n];

        for (int i = 0; i < n; i++) {

            arr[i] = Integer.parseInt(str[i]);

        }
        HashMap<Integer, Integer> hm = new HashMap<>();
        for (int i = 0; i < k; i++) {
            if (hm.containsKey(arr[i])) {
                int temp = hm.get(arr[i]);
                hm.put(arr[i], temp+1);
            }
            else {
                hm.put(arr[i], 1);
            }
        }
        System.out.print(hm.size() +" ");
        for (int i = k; i < n; i++) {
            int temp = hm.get(arr[i-k]);
            if (temp == 1){
				 hm.remove(arr[i-k]);
			}
            else {
				hm.put(arr[i-k], temp-1);
			}
            if (hm.containsKey(arr[i])) {

                temp = hm.get(arr[i]);

                hm.put(arr[i], temp+1);
            }
            else {
                hm.put(arr[i], 1);
            }
            System.out.print(hm.size() +" ");
        }
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?