function Main(range, values) {
	 let [a, b] = range.split(" ").map(Number);
  	 values = values.split(" ").map(Number);

  	 if(b > a) {
     	b = Math.floor(b % (a));
  	 
         if(b % 2 === 0) {
            b--;
         }
     }
  
  	 start = values[0];
  	 while(b > 0) {
      	start = values[start - 1];
        b--;
      }	
  	  
  	  console.log(start);
}

const input = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
Main(input[0], input[1]);