import java.util.Scanner

import scala.collection.mutable


object Main {

  def main(args: Array[String]): Unit = {

    val sc = new Scanner(System.in)

    val n = sc.nextInt() //街の数
    val k = sc.nextLong() //移動回数
    val as = Vector.fill(n)(sc.nextInt()) //街


    val ans = if (n >= k) {
      def l(count: Int, index: Int): Int = {
        count match {
          case _ if count == k + 1 => as(index - 1)
          case _ => println(index); l(count + 1, as(index - 1))
        }
      }

      l(0, 0)
    } else {

      val store = mutable.Set.empty[Int] //行った街を保存
      val history = mutable.ArrayBuffer.empty[Int] //行った街の順番を記録

      //周期を調べる 行ったところで最初に被った街を返す 被られたとこから被ったとこまでが周期
      def loop(nowTown: Int): Int = {
        if (store.contains(nowTown))
          nowTown
        else {
          store += nowTown
          history += nowTown
          val nextTown = as(nowTown - 1)
          loop(nextTown)
        }
      }

      val last = loop(1)
      val notCyclic = history.takeWhile(_ != last) //周期が始まる前の記録
      val cyclic = history.dropWhile(_ != last) //周期

      val i = (k - notCyclic.length) % cyclic.length
      cyclic(i.toInt)
    }


    println(ans)

  }
}
