import sys

from io import StringIO

import unittest



sys.setrecursionlimit(10**6)

def search(n, step, rec, seq, k):

	if rec[n] != -1:

		c = step - rec[n]

		sim = (k - rec[n]) % c

		v = n

		for i in range(sim):

			v = seq[v-1]

		print(v)

		return

	rec[n] = step

	if step == k:

		print(n)

		return

	search(seq[n-1], step + 1, rec, seq, k)

def resolve():

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

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

	rec = [-1]*(n+1)

	search(1, 0, rec, seq, k)



resolve()
def resolve():

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

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

	rec = [True]*(n+2)

	now = 0

	stp = [1]



	while rec[now]:

		rec[now] = False

		now = a[now] - 1

		stp.append(now+1)

	before_loop = stp.index(now+1)

	loop = stp[before_loop:-1]

	if k <= (before_loop + 1):

		print((stp[k]))

	else:

		r = (k - before_loop) % len(loop)

		print((loop[r]))

resolve()
import sys
from io import StringIO
import unittest

sys.setrecursionlimit(10**6)


def search(n, step, rec, seq, k):
    if rec[n] != -1:
        c = step - rec[n]
        sim = (k - rec[n]) % c
        v = n
        for i in range(sim):
            v = seq[v - 1]
        print(v)
        return
    rec[n] = step
    if step == k:
        print(n)
        return
    search(seq[n - 1], step + 1, rec, seq, k)


def resolve():
    n, k = list(map(int, input().split()))
    seq = list(map(int, input().split()))
    rec = [-1] * (n + 1)
    search(1, 0, rec, seq, k)


resolve()

def resolve():
    n, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    rec = [True] * (n + 2)
    now = 0
    stp = [1]
    while rec[now]:
        rec[now] = False
        now = a[now] - 1
        stp.append(now + 1)
    before_loop = stp.index(now + 1)
    loop = stp[before_loop:-1]
    if k <= (before_loop + 1):
        print((stp[k]))
    else:
        r = (k - before_loop) % len(loop)
        print((loop[r]))


resolve()

-import sys -from io import StringIO -import unittest - -sys.setrecursionlimit(10**6) - - -def search(n, step, rec, seq, k): -    if rec[n] != -1: -        c = step - rec[n] -        sim = (k - rec[n]) % c -        v = n -        for i in range(sim): -            v = seq[v - 1] -        print(v) -        return -    rec[n] = step -    if step == k: -        print(n) -        return -    search(seq[n - 1], step + 1, rec, seq, k) - - -    seq = list(map(int, input().split())) -    rec = [-1] * (n + 1) -    search(1, 0, rec, seq, k) +    a = list(map(int, input().split())) +    rec = [True] * (n + 2) +    now = 0 +    stp = [1] +    while rec[now]: +        rec[now] = False +        now = a[now] - 1 +        stp.append(now + 1) +    before_loop = stp.index(now + 1) +    loop = stp[before_loop:-1] +    if k <= (before_loop + 1): +        print((stp[k])) +    else: +        r = (k - before_loop) % len(loop) +        print((loop[r]))