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 search(x:Int, used:Array[Boolean]):Option[(Int, Int)] = {
      def iter(y:Int, ac:Int):Int = if (y == x) ac else iter(ma(y), ac+1)

      // print(s"x:$x ")
      // println(used.mkString(","))
      if (used(x)) Some(iter(1, 0), iter(ma(x), 1)) else None
    }

    def iter(pos:Int, usedTowns:Array[Boolean]):(Int, Int, Int) = {
      search(pos, usedTowns) match {
        case Some((l, r)) => (pos, l, r)
        case None => iter(ma(pos), usedTowns.updated(pos, true))
      }
    }

    iter(1, Array.fill(N+1)(false))
  }

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

  val ma = (0::ls).toArray
  val (pos, lead, loop) = analyze()

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