void main() {
  problem();
}

void problem() {
  const N = scan!int;
  const K = scan!long;
  const A = scan!int(N);

  void solve() {
    int[int] alreadyVisited;

    int count;
    int last;
    for(int next = 1; !(next in alreadyVisited); next = A[next-1]) {
      if (count == K) {
        writeln(next);
        return;
      }

      last = next;
      alreadyVisited[next] = count++;
    }

    const loopback = A[last-1];
    const stepBeforeLoop = alreadyVisited[loopback];
    const loopSize = count - stepBeforeLoop;
    [last, loopback, count, stepBeforeLoop, loopSize].deb;

    const amari = (K - stepBeforeLoop) % loopSize;
    int point = loopback;
    foreach(i; 0..amari) {
      point = A[point - 1];
    }
    writeln(point);
  }

  solve();
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");
import std.bigint, std.functional;

// -----------------------------------------------
