n,k=list(map(int,input().split()))

pl=list(map(int,input().split()))

cl=[0]*2*n

res=[]

next=0

for x in range(k):

  if cl[next]==0:

    cl[next]=1

    next=pl[next]-1

  elif cl[next]==1:

    res.append(next+1)

    cl[next]+=1

    next=pl[next]-1

  else:

    lroop=len(res)

    k-=cl.count(1)

    num=k%lroop

    print((res[num]))

    break

else:

  print((next+1))

n,k=list(map(int,input().split()))

pl=list(map(int,input().split()))

cl=[0]*2*n

order=[]

next=0

for i in range(k):

  if cl[next]==0:

    cl[next]=1

    next=pl[next]-1

  elif cl[next]==1:

    cl[next]=2

    order.append(next+1)

    next=pl[next]-1

  else:

    kk=len(order)

    hasuu=cl.count(1)

    newk=k-hasuu

    ans=newk%kk

    print((order[ans]))

    break

else:

  print((next+1))

n, k = list(map(int, input().split()))
pl = list(map(int, input().split()))
cl = [0] * 2 * n
res = []
next = 0
for x in range(k):
    if cl[next] == 0:
        cl[next] = 1
        next = pl[next] - 1
    elif cl[next] == 1:
        res.append(next + 1)
        cl[next] += 1
        next = pl[next] - 1
    else:
        lroop = len(res)
        k -= cl.count(1)
        num = k % lroop
        print((res[num]))
        break
else:
    print((next + 1))

n, k = list(map(int, input().split()))
pl = list(map(int, input().split()))
cl = [0] * 2 * n
order = []
next = 0
for i in range(k):
    if cl[next] == 0:
        cl[next] = 1
        next = pl[next] - 1
    elif cl[next] == 1:
        cl[next] = 2
        order.append(next + 1)
        next = pl[next] - 1
    else:
        kk = len(order)
        hasuu = cl.count(1)
        newk = k - hasuu
        ans = newk % kk
        print((order[ans]))
        break
else:
    print((next + 1))

-res = [] +order = [] -for x in range(k): +for i in range(k): -        res.append(next + 1) -        cl[next] += 1 +        cl[next] = 2 +        order.append(next + 1) -        lroop = len(res) -        k -= cl.count(1) -        num = k % lroop -        print((res[num])) +        kk = len(order) +        hasuu = cl.count(1) +        newk = k - hasuu +        ans = newk % kk +        print((order[ans]))