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():(Int, Int, Int) = {
    def iter(pos:Int):(Int, Int, Int) = {
      def countStep(y:Int, ac:Int):Int = if (y == pos) ac else countStep(ma(y), ac+1)

      if (usedTowns(pos)) (pos, countStep(1, 0), countStep(ma(pos), 1))
      else {
        usedTowns.update(pos, true)
        iter(ma(pos))
      }
    }

    iter(1)
  }

  def move(s:Int, t:Int):Int = if (t == 0) s else move(ma(s), t-1)

  val ma = (0::ls).toArray
  val usedTowns = Array.fill(N+1)(false)
  val (pos, lead, loop) = analyze()

  // println(s"pos:$pos  load:$lead  loop:$loop")
  println(move(pos, ((K-lead) % loop).toInt))
}
