import math

def fact(n):

    ans = 1

    for i in range(2, n+1):

        ans*= i

    return ans

def comb(n, c):

    return fact(n)//(fact(n-c)*c)

'''

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

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

cnt=  0

i = 1

cycle = ['1']



for c in range(n):

    i = a[i-1]

    if(i in cycle):

        break

    else:

        cycle.append(i)



ind = cycle.index(i)

k-= ind

rcycle = cycle[ind:]

if(k <= 0):

    print(cycle[k+ind])

else:

    now = (k+1)%len(rcycle)

    print(rcycle[now-1])

'''

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

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

already = ["1"]

set = {"1"}

now = 1

 

for i in range(n):

    now = str(a[int(now)-1])

    if now in set:

        break

    else:

        already.append(now)

        set.add(now)

 

 

ind = already.index(now)

k -= ind

cycle = already[ind:]

 

if k <= 0:

    print((already[k+ind]))

else:

    now = (k+1) % len(cycle)

    print((cycle[now-1]))
import math

def fact(n):

    ans = 1

    for i in range(2, n+1):

        ans*= i

    return ans

def comb(n, c):

    return fact(n)//(fact(n-c)*c)

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

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

cnt=  0

i = 1

cycle = ['1']

set = {'1'}

for c in range(n):

    i = a[i-1]

    if(i in set):

        break

    else:

        cycle.append(i)

        set.add(i)



ind = cycle.index(i)

k-= ind

rcycle = cycle[ind:]

if(k <= 0):

    print((cycle[k+ind]))

else:

    now = (k+1)%len(rcycle)

    print((rcycle[now-1]))
import math


def fact(n):
    ans = 1
    for i in range(2, n + 1):
        ans *= i
    return ans


def comb(n, c):
    return fact(n) // (fact(n - c) * c)


"""
n, k = map(int, input().split())
a = list(map(int, input().split()))
cnt=  0
i = 1
cycle = ['1']
for c in range(n):
    i = a[i-1]
    if(i in cycle):
        break
    else:
        cycle.append(i)
ind = cycle.index(i)
k-= ind
rcycle = cycle[ind:]
if(k <= 0):
    print(cycle[k+ind])
else:
    now = (k+1)%len(rcycle)
    print(rcycle[now-1])
"""
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
already = ["1"]
set = {"1"}
now = 1
for i in range(n):
    now = str(a[int(now) - 1])
    if now in set:
        break
    else:
        already.append(now)
        set.add(now)
ind = already.index(now)
k -= ind
cycle = already[ind:]
if k <= 0:
    print((already[k + ind]))
else:
    now = (k + 1) % len(cycle)
    print((cycle[now - 1]))

import math


def fact(n):
    ans = 1
    for i in range(2, n + 1):
        ans *= i
    return ans


def comb(n, c):
    return fact(n) // (fact(n - c) * c)


n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
cnt = 0
i = 1
cycle = ["1"]
set = {"1"}
for c in range(n):
    i = a[i - 1]
    if i in set:
        break
    else:
        cycle.append(i)
        set.add(i)
ind = cycle.index(i)
k -= ind
rcycle = cycle[ind:]
if k <= 0:
    print((cycle[k + ind]))
else:
    now = (k + 1) % len(rcycle)
    print((rcycle[now - 1]))

-""" -n, k = map(int, input().split()) +n, k = list(map(int, input().split())) -cnt=  0 +cnt = 0 -cycle = ['1'] +cycle = ["1"] +set = {"1"} -    i = a[i-1] -    if(i in cycle): +    i = a[i - 1] +    if i in set: +        set.add(i) -k-= ind +k -= ind -if(k <= 0): -    print(cycle[k+ind]) +if k <= 0: +    print((cycle[k + ind])) -    now = (k+1)%len(rcycle) -    print(rcycle[now-1]) -""" -n, k = list(map(int, input().split())) -a = list(map(int, input().split())) -already = ["1"] -set = {"1"} -now = 1 -for i in range(n): -    now = str(a[int(now) - 1]) -    if now in set: -        break -    else: -        already.append(now) -        set.add(now) -ind = already.index(now) -k -= ind -cycle = already[ind:] -if k <= 0: -    print((already[k + ind])) -else: -    now = (k + 1) % len(cycle) -    print((cycle[now - 1])) +    now = (k + 1) % len(rcycle) +    print((rcycle[now - 1]))