// import scala.io.StdIn._
import java.util.Scanner

object Main extends App {
  def readALine(c:Int):List[Int] = if (c > 0) sc.nextInt::readALine(c-1) else Nil
  def readLines(r:Int, c:Int):List[List[Int]] = if (r > 0) readALine(c)::readLines(r-1, c) else Nil
  val sc = new Scanner(System.in)
  val N = sc.nextInt
  val K = sc.nextLong
  val ls = readALine(N)
//  println(ls)

  def analyze(ma:Array[Int]):(List[Int], List[Int]) = {
    def search(l:List[Int], x:Int, ac:List[Int]):(List[Int], List[Int], Boolean) = {
      l match {
        case Nil => (ac, Nil, false)
        case y::ys => if (y==x) (y::ac, ys, true) else search(ys, x, y::ac)
      }
    }

    def iter(pos:Int, log:List[Int]):(List[Int], List[Int]) = {
      search(log, pos, Nil) match {
        case (_,_, false) => iter(ma(pos), pos::log)
        case (l, r, true) => (l, r.reverse)
      }
    }
    iter(1, Nil)
  }

  val (loop, lead) = analyze((0::ls).toArray)
  println(loop(((K-lead.length) % loop.length).toInt))
}