object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datN, datK) = readLine.split(" ").map(_.toLong)
    val datA = readLine.split(" ").map(_.toInt - 1)
    val sc = datA.map(a => (false, a))

    def detectLoopEnd(hop: Int, cur: Int, vec: Vector[(Boolean, Int)]): (Int, Int) = vec(cur) match {
        case (arrived, _) if(arrived && hop != 0) => (hop, cur)
        case (_, pos) => detectLoopEnd(hop + 1, pos, vec.updated(cur, (true, pos)))
    }
    val (hopLoopEnd, hopLoopPos) = detectLoopEnd(0, 0, sc.toVector.updated(0, (true, datA(0))))
    //println("DEBUG1:" + hopLoopEnd + " " + hopLoopPos)

    def detectLoopStart(hop: Int, cur: Int, dest: Int): Int = {
      if (cur == dest) hop
      else detectLoopStart(hop + 1, datA(cur), dest)
    }
    val hopLoopStart = detectLoopStart(0, 0, hopLoopPos)
    //println("DEBUG2:" + hopLoopStart)

    def traverse(pos: Int, count: Long): Int = {
      if(count == 0) pos
      else traverse(datA(pos), count - 1)
    }
    val ans = traverse(0, if(datK > hopLoopEnd) (datK % (hopLoopEnd - hopLoopStart)) else datK)
    println(ans + 1)
  }
}
