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

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



D = 60 #10**18は60桁なので2の59乗まで見る

MAX_N = 200005 #頂点番号

to = [[0 for _ in range(MAX_N)] for _ in range(D)]



#to[i][j]:jから2^i個先の頂点

for i in range(n):

    to[0][i] = A[i]

    to[0][i] -= 1



#ダブリングの表

for i in range(D-1):

    for j in range(n):

        to[i+1][j] = to[i][to[i][j]]



v = 0

for i in range(D-1, -1, -1):

    l = 1<<i #2^i個先を見る

    if l <= k:

        v = to[i][v]

        k -= l



print((v+1))
def main():

  ## IMPORT MODULE

  #import sys



  #sys.setrecursionlimit(100000)

  #input=lambda :sys.stdin.readline().rstrip()



  #f_inf=float("inf")

  #MOD=10**9+7

  

  if 'get_ipython' in globals(): 

    ## SAMPLE INPUT

    n, k = 4, 5

    A = [3, 2, 4, 1]



  else:

    ##INPUT 

    #n = input()

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

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



  ## SUBMITION CODES HERE

  Town = []

  rec = [-1] * (n+1) # The town we haven't visited yet is -1

  idx = 1



  # Loop to the cycle

  while (rec[idx] == -1):

    rec[idx] = len(Town)

    Town.append(idx)

    idx = A[idx-1]



  # Pre-cycle

  Exce = rec[idx]

  # Intra-cycle

  Cycl = len(Town) - Exce



  if Exce > k:

    print((Town[k]))

  else:

    Warp = (k - Exce) % Cycl

    print((Town[Exce+Warp]))

  

main()
n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
D = 60  # 10**18は60桁なので2の59乗まで見る
MAX_N = 200005  # 頂点番号
to = [[0 for _ in range(MAX_N)] for _ in range(D)]
# to[i][j]:jから2^i個先の頂点
for i in range(n):
    to[0][i] = A[i]
    to[0][i] -= 1
# ダブリングの表
for i in range(D - 1):
    for j in range(n):
        to[i + 1][j] = to[i][to[i][j]]
v = 0
for i in range(D - 1, -1, -1):
    l = 1 << i  # 2^i個先を見る
    if l <= k:
        v = to[i][v]
        k -= l
print((v + 1))

def main():
    ## IMPORT MODULE
    # import sys
    # sys.setrecursionlimit(100000)
    # input=lambda :sys.stdin.readline().rstrip()
    # f_inf=float("inf")
    # MOD=10**9+7
    if "get_ipython" in globals():
        ## SAMPLE INPUT
        n, k = 4, 5
        A = [3, 2, 4, 1]
    else:
        ##INPUT
        # n = input()
        n, k = list(map(int, input().split()))
        A = list(map(int, input().split()))
    ## SUBMITION CODES HERE
    Town = []
    rec = [-1] * (n + 1)  # The town we haven't visited yet is -1
    idx = 1
    # Loop to the cycle
    while rec[idx] == -1:
        rec[idx] = len(Town)
        Town.append(idx)
        idx = A[idx - 1]
    # Pre-cycle
    Exce = rec[idx]
    # Intra-cycle
    Cycl = len(Town) - Exce
    if Exce > k:
        print((Town[k]))
    else:
        Warp = (k - Exce) % Cycl
        print((Town[Exce + Warp]))


main()

-n, k = list(map(int, input().split())) -A = list(map(int, input().split())) -D = 60  # 10**18は60桁なので2の59乗まで見る -MAX_N = 200005  # 頂点番号 -to = [[0 for _ in range(MAX_N)] for _ in range(D)] -# to[i][j]:jから2^i個先の頂点 -for i in range(n): -    to[0][i] = A[i] -    to[0][i] -= 1 -# ダブリングの表 -for i in range(D - 1): -    for j in range(n): -        to[i + 1][j] = to[i][to[i][j]] -v = 0 -for i in range(D - 1, -1, -1): -    l = 1 << i  # 2^i個先を見る -    if l <= k: -        v = to[i][v] -        k -= l -print((v + 1)) +def main(): +    ## IMPORT MODULE +    # import sys +    # sys.setrecursionlimit(100000) +    # input=lambda :sys.stdin.readline().rstrip() +    # f_inf=float("inf") +    # MOD=10**9+7 +    if "get_ipython" in globals(): +        ## SAMPLE INPUT +        n, k = 4, 5 +        A = [3, 2, 4, 1] +    else: +        ##INPUT +        # n = input() +        n, k = list(map(int, input().split())) +        A = list(map(int, input().split())) +    ## SUBMITION CODES HERE +    Town = [] +    rec = [-1] * (n + 1)  # The town we haven't visited yet is -1 +    idx = 1 +    # Loop to the cycle +    while rec[idx] == -1: +        rec[idx] = len(Town) +        Town.append(idx) +        idx = A[idx - 1] +    # Pre-cycle +    Exce = rec[idx] +    # Intra-cycle +    Cycl = len(Town) - Exce +    if Exce > k: +        print((Town[k])) +    else: +        Warp = (k - Exce) % Cycl +        print((Town[Exce + Warp])) + + +main()