import java.util.*;
public class SLKthElement {
public static void main(String args[]) {
Integer arr[] = new Integer[] { 11, 2, 23, 9, 4, 100, 50, 63 };
Scanner sc = new Scanner(System.in);
System.out.println("Enter value of K");
int k = sc.nextInt();
Arrays.sort(arr);
System.out.println("Smallest " + k + "th " + "element is " + arr[k]);
Arrays.sort(arr, Collections.reverseOrder());
System.out.println("Largest " + k + "th " + "element is " + arr[k]);
}
}