title: maximize the top element of the stack after performing exactly K operations
body: <p>Given a stack of N integers.You need to maximize the top element of the stack after performing exactly K operations.In one operation, you can either pop an element from the stack or push any popped element into the stack. If the stack becomes empty after performing K operations and there is no other way for the stack to be non-empty, print -1.</p>
  
  <p>Input format :</p>
  
  <p>The first line of input consists of two space-separated integers N and K.
  The second line of input consists N space-separated integers denoting the elements of the stack. The first element represents the top of the stack and the last element represents the bottom of the stack.</p>
  
  <p>Output format :</p>
  
  <p>Print the maximum possible top element of the stack after performing exactly K operations.</p>
  
  <p>Sample Input</p>
  
  <p>6 4</p>
  
  <p>1 2 4 3 3 5</p>
  
  <p>Sample Output</p>
  
  <p>4</p>