#include "bits/stdc++.h"

using namespace std;

#define rep(loop, N) for (int loop = 0; loop < N; loop++)

struct Node {
	Node* parent = NULL;
	vector<Node*> child;
	long long value = 0;
};
struct Edge {
	int parent = 0;
	int child = 0;
	bool operator <(const Edge& right) const { return parent < right.parent; }
};
struct Tree {
	vector<Node> node;
	Tree(int, vector<Edge>);
};
Tree::Tree(int nodeNum, vector<Edge> edge) {
	node.resize(nodeNum);
	for (Edge& it : edge) {
		node[it.child].parent = &node[it.parent];
		node[it.parent].child.push_back(&node[it.child]);
	}
}

map<long long, int> factorization(long long N) {
	map<long long, int> re;
	while (true) {
		if (N % 2 == 0) {
			N /= 2;
			re[2]++;
			if (N == 1) break;
		}
		else {
			break;
		}
	}
	for (int loop = 3; (long long)loop * (long long)loop <= N; loop += 2) {
		if (N % loop == 0) {
			N /= loop;
			re[loop]++;
			loop -= 2;
			if (N == 1) break;
		}
	}
	if (N > 1) re[N]++;
	return re;
}
long long gcd(long long num1, long long num2) {
	return num2 == 0 ? num1 : gcd(num2, num1 % num2);
}

struct Memo {
	long long fact = 0;
	long long fact_inv = 0;
	long long inv = 0;
};
class Combination1 {
private:
	long long m_module = 1000000007;
	vector<struct Memo> memo;
public:
	long long calculate(int, int);
	Combination1(int, long long);
};
long long Combination1::calculate(int n, int k) {
	return ((memo[n].fact * memo[k].fact_inv) % m_module * memo[n - k].fact_inv) % m_module;
}
Combination1::Combination1(int memo_max, long long module = 1000000007) {
	m_module = module;
	memo.push_back({ 1,1,0 });
	memo.push_back({ 1,1,1 });
	for (int loop = 2; loop <= memo_max; loop++) {
		struct Memo temp;
		temp.fact = (memo[loop - 1].fact * loop) % m_module;
		temp.inv = m_module - (memo[m_module % loop].inv * int(m_module / loop)) % m_module;
		temp.fact_inv = (memo[loop - 1].fact_inv * temp.inv) % m_module;
		memo.push_back(temp);
	}
}

class Combination2 {
private:
	int size = 0;
	bool add(int);
public:
	vector<int> sequence;
	bool next_combination(void);
	Combination2(int, int);
};
bool Combination2::add(int index) {
	if (index == (int)sequence.size() - 1 && sequence[index] == size - 1
		|| index < (int)sequence.size() - 1 && sequence[index] == sequence[index + 1] - 1) {
		if (index == 0) {
			return false;
		}
		else {
			bool re = add(index - 1);
			sequence[index] = sequence[index - 1] + 1;
			return re;
		}
	}
	else {
		sequence[index]++;
		return true;
	}
}
bool Combination2::next_combination(void) {
	return (sequence.size() == 0) ? false : add(sequence.size() - 1);
}
Combination2::Combination2(int n, int r) {
	size = n;
	for (int loop = 0; loop < r; loop++) sequence.push_back(loop);
	return;
}

void A_Registration(void) {

	string S, T; cin >> S >> T;

	if (S.size() + 1 == T.size() && S == T.substr(0, S.size())) cout << "Yes" << endl;
	else														cout << "No" << endl;
	return;
}

void B_Easy_Linear_Programming(void) {

	int A, B, C, K; cin >> A >> B >> C >> K;

	if (K > A + B)	cout << A * 2 + B - K << endl;
	else if (K > A)	cout << A << endl;
	else			cout << K << endl;

	return;
}

void C_Skill_Up(void) {

	struct Book { 
		int price = 0; 
		vector<int> improve; 
	};

	int N, M, X; cin >> N >> M >> X;
	vector<Book> book(N);
	for (Book& it : book) {
		cin >> it.price;
		rep(loop, M) {
			int A; cin >> A; 
			it.improve.push_back(A);
		}
	}

	vector<bool> buy(N);
	int bit_max = (int)pow(2, N);
	int min_sum = -1;
	rep(bit, bit_max) {
		int lc_bit = bit;
		rep(index, N) {
			buy[index] = bool((lc_bit % (int)pow(2, index + 1)) / (int)pow(2, index));
			lc_bit -= (int)buy[index] * (int)pow(2, index);
		}
		int price_sum = 0;
		vector<int> ability(M);
		rep(index, N) {
			if (buy[index]) {
				price_sum += book[index].price;
				rep(index2, M) {
					ability[index2] += book[index].improve[index2];
				}
			}
		}
		if (ability[distance(ability.begin(), min_element(ability.begin(), ability.end()))] >= X) {
			min_sum = min_sum == -1 ? price_sum : min(price_sum, min_sum);
		}
	}

	cout << min_sum << endl;
	return;
}

void D_Teleporter(void) {

	int N; long long K; cin >> N >> K;
	vector<int> A(N);
	for (int& there : A) {
		cin >> there; there--;
	}

	vector<int> visited(N);
	fill(visited.begin(), visited.end(), -1);
	visited[0] = 0;
	vector<int> route(1);
	route[0] = 0;
	int index = 0;
	for (int loop = 1; loop <= (int)min((long long)N, K); loop++) {
		index = A[index];
		route.push_back(index);
		if (visited[index] == -1) {
			visited[index] = loop;
		}
		else {
			int freq = loop - visited[index];
			int rem = int((K - (long long)visited[index]) % (long long)freq);
			cout << route[visited[index] + rem] + 1 << endl;
			return;
		}
	}
	cout << route[(int)K] + 1 << endl;
	return;
}

int main(void) {

	cout << fixed << setprecision(15);
	
	//A_Registration();
	//B_Easy_Linear_Programming();
	//C_Skill_Up();
	D_Teleporter();
	return 0;
}


Measured memory_bytes: 5904