#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline int my_getchar_unlocked(){
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if(s == e && e == 1048576){
    e = fread_unlocked(buf, 1, 1048576, stdin);
    s = 0;
  }
  if(s == e){
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
inline void rd(long long &x){
  int k;
  int m=0;
  x=0;
  for(;;){
    k = my_getchar_unlocked();
    if(k=='-'){
      m=1;
      break;
    }
    if('0'<=k&&k<='9'){
      x=k-'0';
      break;
    }
  }
  for(;;){
    k = my_getchar_unlocked();
    if(k<'0'||k>'9'){
      break;
    }
    x=x*10+k-'0';
  }
  if(m){
    x=-x;
  }
}
struct MY_WRITER{
  char buf[1048576];
  int s;
  int e;
  MY_WRITER(){
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER(){
    if(s){
      fwrite_unlocked(buf, 1, s, stdout);
    }
  }
}
;
MY_WRITER MY_WRITER_VAR;
void my_putchar_unlocked(int a){
  if(MY_WRITER_VAR.s == MY_WRITER_VAR.e){
    fwrite_unlocked(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a){
  my_putchar_unlocked(a);
}
inline void wt_L(int x){
  int s=0;
  int m=0;
  char f[10];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned x){
  int s=0;
  char f[10];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(long long x){
  int s=0;
  int m=0;
  char f[20];
  if(x<0){
    m=1;
    x=-x;
  }
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  if(m){
    my_putchar_unlocked('-');
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
inline void wt_L(unsigned long long x){
  int s=0;
  char f[21];
  while(x){
    f[s++]=x%10;
    x/=10;
  }
  if(!s){
    f[s++]=0;
  }
  while(s--){
    my_putchar_unlocked(f[s]+'0');
  }
}
int WRITER_DOUBLE_DIGIT = 15;
inline int writerDigit_double(){
  return WRITER_DOUBLE_DIGIT;
}
inline void writerDigit_double(int d){
  WRITER_DOUBLE_DIGIT = d;
}
inline void wt_L(double x){
  const int d = WRITER_DOUBLE_DIGIT;
  int k;
  int r;
  double v;
  if(x!=x || (x==x+1 && x==2*x)){
    my_putchar_unlocked('E');
    my_putchar_unlocked('r');
    my_putchar_unlocked('r');
    return;
  }
  if(x < 0){
    my_putchar_unlocked('-');
    x = -x;
  }
  x += 0.5 * pow(0.1, d);
  r = 0;
  v = 1;
  while(x >= 10*v){
    v *= 10;
    r++;
  }
  while(r >= 0){
    r--;
    k = floor(x / v);
    if(k >= 10){
      k = 9;
    }
    if(k <= -1){
      k = 0;
    }
    x -= k * v;
    v *= 0.1;
    my_putchar_unlocked(k + '0');
  }
  if(d > 0){
    my_putchar_unlocked('.');
    v = 1;
    for(r=(0);r<(d);r++){
      v *= 0.1;
      k = floor(x / v);
      if(k >= 10){
        k = 9;
      }
      if(k <= -1){
        k = 0;
      }
      x -= k * v;
      my_putchar_unlocked(k + '0');
    }
  }
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    my_putchar_unlocked(c[i]);
  }
}
inline void wt_L(string &x){
  int i=0;
  for(i=0;x[i]!='\0';i++){
    my_putchar_unlocked(x[i]);
  }
}
struct IntMap{
  int n;
  int mem;
  int logn;
  int *dat;
  int **nx;
  int calc_nx;
  int numCycle;
  int *cycleLen;
  int **cycle;
  int *int2c;
  int *int2cInd;
  IntMap(){
    n = mem = logn = 0;
    calc_nx = 0;
    numCycle = 0;
  }
  IntMap(int nn){
    n = mem = nn;
    for(logn=0; (1<<logn)<n; logn++){
      ;
    }
    logn++;
    if(mem > 0){
      dat = new int[mem];
    }
    calc_nx = 0;
    numCycle = 0;
  }
  ~IntMap(){
    if(mem){
      delete[] dat;
    }
    if(calc_nx){
      int i;
      for(i=(0);i<(logn);i++){
        delete[] nx[i];
      }
      delete[] nx;
    }
    if(numCycle > 0){
      int i;
      delete[] cycleLen;
      for(i=(0);i<(numCycle);i++){
        delete[] cycle[i];
      }
      delete[] cycle;
      delete[] int2c;
      delete[] int2cInd;
    }
  }
  void changeSize(const int nn){
    int old_logn = logn;
    n = nn;
    for(logn=0; (1<<logn)<n; logn++){
      ;
    }
    logn++;
    if(mem < n){
      if(mem){
        delete [] dat;
      }
      mem = n;
      dat = new int [mem];
    }
    if(calc_nx){
      int i;
      for(i=(0);i<(old_logn);i++){
        delete[] nx[i];
      }
      delete[] nx;
      calc_nx = 0;
    }
    if(numCycle > 0){
      int i;
      delete[] cycleLen;
      for(i=(0);i<(numCycle);i++){
        delete[] cycle[i];
      }
      delete[] cycle;
      delete[] int2c;
      delete[] int2cInd;
      numCycle = 0;
    }
  }
  int calcCycle(void){
    int i;
    int j;
    int k;
    if(numCycle){
      delete[] cycleLen;
      for(i=(0);i<(numCycle);i++){
        delete[] cycle[i];
      }
      delete[] cycle;
      delete[] int2c;
      delete[] int2cInd;
      numCycle = 0;
    }
    int2c = new int[n];
    int2cInd = new int[n];
    for(i=(0);i<(n);i++){
      int2c[i] = -2;
    }
    for(i=(0);i<(n);i++){
      int2cInd[i] = -1;
    }
    numCycle = 0;
    for(i=(0);i<(n);i++){
      if(int2c[i] == -2){
        j = i;
        for(;;){
          if(int2c[j] != -2){
            break;
          }
          int2c[j] = -3;
          j = dat[j];
        }
        if(int2c[j] == -3){
          k = 0;
          for(;;){
            if(int2c[j] != -3){
              break;
            }
            int2c[j] = numCycle;
            int2cInd[j] = k++;
            j = dat[j];
          }
          numCycle++;
        }
        j = i;
        for(;;){
          if(int2c[j] != -3){
            break;
          }
          int2c[j] = -1;
          j = dat[j];
        }
      }
    }
    cycleLen = new int[numCycle];
    for(i=(0);i<(numCycle);i++){
      cycleLen[i] = 0;
    }
    for(i=(0);i<(n);i++){
      if(int2c[i] >= 0){
        cycleLen[int2c[i]]++;
      }
    }
    cycle = new int*[numCycle];
    for(i=(0);i<(numCycle);i++){
      cycle[i] = new int[cycleLen[i]];
    }
    for(i=(0);i<(n);i++){
      if(int2c[i] >= 0){
        cycle[int2c[i]][int2cInd[i]] = i;
      }
    }
    return numCycle;
  }
  void calcNext(int recalc = 1){
    int i, k;
    if(recalc || numCycle==0){
      calcCycle();
    }
    if(calc_nx == 0){
      int i;
      calc_nx = 1;
      nx = new int*[logn];
      for(i=(0);i<(logn);i++){
        nx[i] = new int[n];
      }
    }
    for(i=(0);i<(n);i++){
      nx[0][i] = dat[i];
    }
    for(k=(1);k<(logn);k++){
      for(i=(0);i<(n);i++){
        nx[k][i] = nx[k-1][nx[k-1][i]];
      }
    }
  }
  template<class T> int getNext(int x, T s){
    int i;
    if(calc_nx==0){
      calcNext();
    }
    if(s >= (1<<(logn-1))){
      x = nx[logn-1][x];
      s -= (1<<(logn-1));
      return cycle[int2c[x]][(int2cInd[x]+s)%cycleLen[int2c[x]]];
    }
    for(i=(0);i<(logn);i++){
      if(s&1<<i){
        x = nx[i][x];
      }
    }
    return x;
  }
  inline int& operator[](const int a){
    return dat[a];
  }
}
;
int main(){
  int N;
  long long K;
  rd(N);
  rd(K);
  IntMap A(N);
  {
    int Lj4PdHRW;
    for(Lj4PdHRW=(0);Lj4PdHRW<(N);Lj4PdHRW++){
      rd(A[Lj4PdHRW]);A[Lj4PdHRW] += (-1);
    }
  }
  wt_L(A.getNext(0,K)+1);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200509-1

// --- original code ---
// {
//   int N; ll K;
//   rd(N,K);
//   IntMap A(N);
//   rd((A--)(N));
//   wt(A.getNext(0,K)+1);
// }


Measured memory_bytes: 30060