n, k = map(int, input().split())
list = list(map(int, input().split()))
val = list[0]
startcnt = 1
roopList = []
roopList.append(1)
while True:
    roopList.append(val)
    val = list[val - 1]
    startcnt += 1
    if val in roopList:
        break
roopCount = len(roopList) - roopList.index(val)
if k <= startcnt:
    print(roopList[k])
else:
    roopList = roopList[roopList.index(val):]   
    print(roopList[(k - startcnt) % roopCount])
