#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

// header
template <typename T>
string to_string(T o);
template <typename T>
string to_string(vector<T> v);
template <typename T>
string to_string(vector<vector<T>> m);
template <typename K, typename V>
string to_string(pair<K, V> p);
template <typename K, typename V>
string to_string(map<K, V> m);
template <typename T>
string to_string(set<T> ss);
template <typename T>
string to_string(queue<T> q);

// 実装
template <typename T>
string to_string(T o)
{
  stringstream s;
  s << o;
  return s.str();
}

template <typename T>
string to_string(vector<T> v)
{
  stringstream s;
  s << "[";
  for (auto i = 0; i < v.size(); i++)
  {
    s << to_string(v.at(i));
    if (i != v.size() - 1)
    {
      s << ", ";
    }
  }
  s << "]";
  return s.str();
}

template <typename T>
ostream &operator<<(ostream &o, const vector<T> &obj)
{
  o << to_string(obj);
  return o;
}

template <typename T>
string to_string(vector<vector<T>> m)
{
  stringstream s;
  s << "[" << endl;
  for (auto i = 0; i < m.size(); i++)
  {
    auto v = m[i];
    s << "  "
      << "#" << i << ":"
      << " " << to_string(v);
    s << ", " << endl;
  }
  s << "]";
  return s.str();
}

template <typename T>
ostream &operator<<(ostream &o, const vector<vector<T>> &obj)
{
  o << to_string(obj);
  return o;
}

template <typename K, typename V>
string to_string(pair<K, V> p)
{
  stringstream s;
  s << "pair(" << to_string(p.first) << ", " << to_string(p.second) << ")";
  return s.str();
}

template <typename K, typename V>
ostream &operator<<(ostream &o, const pair<K, V> &obj)
{
  o << to_string(obj);
  return o;
}

template <typename T>
string to_string(set<T> ss)
{
  stringstream s;
  s << "set"
    << "{";
  for (auto itr = ss.begin(); itr != ss.end(); itr++)
  {
    s << to_string(*itr);
    if (next(itr, 1) != ss.end())
    {
      s << ", ";
    }
  }
  s << "}";
  return s.str();
}

template <typename T>
ostream &operator<<(ostream &o, const set<T> &obj)
{
  o << to_string(obj);
  return o;
}

template <typename T>
string to_string(queue<T> q)
{
  auto temp = queue<T>{};
  stringstream s;
  s << "queue{";
  while (!q.empty())
  {
    auto top = q.front();
    s << to_string(top) << ", ";
    q.pop();
    temp.push(top);
  }
  s << "}";

  while (!temp.empty())
  {
    auto top = temp.front();
    temp.pop();
    q.push(top);
  }

  return s.str();
}

template <typename T>
ostream &operator<<(ostream &o, const queue<T> &obj)
{
  o << to_string(obj);
  return o;
}

int main()
{
  ll n, k;
  cin >> n >> k;

  vector<ll> as;
  for (auto i = 0; i < n; i++)
  {
    ll a;
    cin >> a;
    as.push_back(a);
  }

  vector<ll> routes;
  routes.push_back(1);
  set<ll> visited = {};
  visited.insert(1);

  ll cnt = 0;
  ll next_route = as[0];
  while (visited.count(next_route) == 0)
  {
    visited.insert(next_route);
    routes.push_back(next_route);
    next_route = as[next_route - 1];
  }
  auto cycle_start_itr = find(routes.begin(), routes.end(), next_route);
  auto cycle_start = distance(routes.begin(), cycle_start_itr);

  ll offset = cycle_start;
  ll cycle = routes.size() - offset;

  // cout << routes << endl;
  // cout << k % routes.size() << endl;

  if (k < routes.size())
  {
    cout << routes[k] << endl;
  }
  else
  {
    ll x = k - offset;
    ll mod = x % cycle;
    cout << routes[offset + mod] << endl;
  }

  // cout << routes[mod] << endl;
  return 0;
}


Measured memory_bytes: 15448