Help me in solving PROC18A problem

My issue

My code

/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;

/* Name of the class has to be "Main" only if the class is public. */
class Codechef
	public static void main (String[] args) throws java.lang.Exception
		// your code goes here

Problem Link: PROC18A Problem - CodeChef

The logic is create a window of size K then apply sliding window on the while array and pick the maximum value among them.