#include <cstdio>
#include <vector>

int main() {
  using namespace std;
  long long n, k, res;
  scanf("%lld%lld", &n, &k);
  vector<vector<int> > tab(64, vector<int>(n + 1));

  for (int i = 1; i <= n; ++i) scanf("%d", &tab[0][i]);

  for (int i = 0; i < 61; ++i)
    for (int j = 1; j <= n; ++j) tab[i + 1][j] = tab[i][tab[i][j]];

  res = 1;
  for (int i = 61; i > -1; --i)
    if (k >= (1LL << i)) res = tab[i][res], k -= 1LL << i;

  printf("%lld\n", res);
  return 0;
}
