func readTwoInts(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int($0)! }
    return (a: ints[0], b: ints[1])
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int($0)! }
}

func mainD() {
    let (N, K) = readTwoInts()
    let telepoter = readInts()

    var position = 1
    var positions = Set<Int>()
    var iCount = 1

    for i in 1...K {
        let nextPosition = telepoter[position - 1]
        let previousCount = positions.count
        positions.insert(nextPosition)

        if previousCount == positions.count {
            iCount = i
            break
        }

        position = nextPosition
    }

    var roop = Set<Int>()
    var roopPositions: [Int] = []
    for j in (iCount-1)...K {
        let nextPosition = telepoter[position - 1]
        let previousCount = roop.count
        position = nextPosition
        roop.insert(nextPosition)
        roopPositions.append(nextPosition)

        if previousCount == roop.count {
            // 修正
            let cycle = roop.count

            let answerIndex = (K - (iCount - cycle)) % cycle
            print(roopPositions[answerIndex])
            break
        }
    }
}
mainD()