#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
	int n;
	long long k;
	int a[200000];
	map<int, ll> b;
	cin >> n >> k;
	for (int i = 0; i < n; i++)
	{
		cin >> a[i];
	}
	int dst = 1;
	int loop = 0;

	for (ll i = 1; i <= k; i++)
	{
		dst = a[dst - 1];
		auto it = b.find(dst);
		if (it != b.end())
		{
			loop = i - it->second;

			k = i + (k - i) % loop;
		}
		else
		{
			b[dst] = i;
		}
	}
	cout << dst << endl;
}