For this Question: Given an array Arr of size N and an integer K. Todo wants you to find lexicographically minimum subsequence of the array of size K.
A subsequence is a sequence that can be derived from array by deleting some or no elements without changing the order of the remaining elements.
A sequence X is lexicographically smaller than Y if in the first position where X and Y differ, subsequence X has a number less than the corresponding number in Y.First line of input contains two integers N and K.
Second line of input contains N integers denoting array Arr.

Constraints: 
1 <= K <= N <= 100000
1 <= Arr[i] <= 1000000000Print K integers denoting the lexicographically minimum subsequence of the array of size K.Sample Input 1
5 2
12 2 1 3 4

Sample Output 1
1 3

Sample Input 2
5 4
12 2 1 3 4

Sample Output 2
2 1 3 4, 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[] input = br.readLine().split(" ");
        int n = Integer.parseInt(input[0]);
        int k = Integer.parseInt(input[1]);
        input = br.readLine().split(" ");
        int[] arr = new int[n];
        for(int i=0; i<n; i++)
        arr[i] = Integer.parseInt(input[i]);

        int index = -1;
        for(int i=0; i<k; i++){
            int min = index+1;
            for(int j = index+1; j<=n-k+i; j++){
                if(arr[j] < arr[min])
                min = j;
            }

            index = min;
            int temp = arr[min];
            arr[min] = arr[i];
            arr[i] = temp;
        }
        StringBuilder sb = new StringBuilder();
        for(int i=0; i<k; i++){
            sb.append(arr[i]).append(" ");
        }
        System.out.println(sb.toString());


	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?