import std.stdio, std.conv, std.string, std.algorithm,
       std.math, std.array, std.container, std.typecons;

long n, k;
long[] a;

long next(long x) {
  return a[x-1];
}

bool visitable(long x, long y) {
  for(int i=0; i<n; i++) {
    x=x.next;
    if(x==y) return true;
  }
  return false;
}

long[][] memo;
long looplen(long x, long y) {
  long x2 = x.next;
  if(x2==y) {
    memo[x][y]=1;
    return 1;
  }
  if(!visitable(x,y)) return false;
  long z = looplen(x2, y);
  if(z>0) {
    memo[x][y] = x+1;
    return z+1;
  }
  return 0;
}

void main() {
  readf("%d %d\n", &n, &k);
  a = readln.chomp.split.to!(long[]);
  memo = new long[][](n+1,n+1);
  long i=1;
  long j=0;
  while(looplen(i,i)==0) {
    i = i.next;
    k--;
    j++;
  }
  long z = k % looplen(i,i);
  for(long l=0; l<z; l++) i = i.next;
  i.writeln;
}
