For this Question: Given a deque of N integers and an integer K. Reversing the first K elements of a deque and print it.First line contains an integer N and K.
Next line contains N space separated integers denoting elements of deque.

Constraints
1 <= K <= N <= 10^5
0 <= Ai<= 10^5Print N space separated integers - the elements of deque after reversing the first K elements.Sample Input 1:
5 2
1 2 3 4 5

Output 
2 1 3 4 5

Explanation:
Reversing : (1 2)(3 4 5) - > (2 1)(3 4 5) 

Sample Input 2:
4 3
1 3 4 2

Output 
4 3 1 2

Explanation
Reversing : (1 3 4)(2) - > (4 3 1)(2), I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
    public static void main(String[] args) throws Exception {

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader br = new BufferedReader(is);

        String[] strNums;
        strNums = br.readLine().split(" ");

        int n = Integer.parseInt(strNums[0]);
        int k = Integer.parseInt(strNums[1]);

        strNums = br.readLine().split(" ");
        Stack<Integer> st = new Stack<>();

        for(int i = 0; i < k; i++){
            st.push(Integer.parseInt(strNums[i]));
        }

        while(st.size() > 0){
            System.out.print(st.pop() + " ");
        }

        for(int i = k; i < n; i++){
            int val = Integer.parseInt(strNums[i]);
            System.out.print(val + " ");
        }
    }
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?