using System;
using System.Collections;
using System.Collections.Generic;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.ExceptionServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading;

namespace ForATCODER
{
    public class Program
    {
        public static void Main(string[] args)
        {
            long[] data = s2larray(Console.ReadLine().Split(' '));
                long[] d = s2larray(Console.ReadLine().Split(' '));
            long locate = 0;
            List<long> a = new List<long>();
            bool bn = false;
          //  RESULT(locate);
         //   if (data[1] <= 200000) { bn = true; };
            for (long i = 0; i < data[1];i++)
            {
                long to = d[locate]-1;
                locate = to;
              if(!bn)  a.Add(locate);
          //    RESULT(locate);
                //
                if(i==400000+1 && !bn)
                {
                    var c = a.GroupBy(a => a).Select(c => new { d= c,Count = c.Count() });
                    int max = c.Max(x=> x.Count);
                    max /= 2;

                    var b = a.Distinct();
                    int cccc = 0;
                    long first = -999;
                    int plus = -1;
                    foreach (var item in c)
                    {
                        if (item.Count > max)
                        {
                            if (first < -1) first = item.d.Key;
                            if (item.d.Key == locate) plus = cccc;
                            cccc++;
                        }
                    }
                    i -= plus;
                    i += ((data[1] - i) / cccc)*cccc;
                    if (i >= data[1]) i -= cccc;
                   // i--;
                    //  RESULT(((long)(Math.Floor((decimal)data[1] / cccc))));
                 //   i += cccc * (data[1]/cccc);
                  //  RESULT(b.Count());

                  // i += cccc*(data[1]/cccc);
                   
                  //  i -= 1000;
                 //  i-=2;
                   // if (i >= data[1]) i -= cccc * 100;
                    locate = first;
                    bn = true;
                }
            }
            RESULT(locate+1);
        }
     public static bool checka(int[] a,int m)
        {
            int back = 1;
            for(int i = 0; i<a.Length;i++)
            {
                if(a[i] >=1 && a[i] <=m)
                {
if(a[i] >= back)
                    {
                        back = a[i];
                    }
                    else
                    {
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
        public static ulong pow(int a, int b)
        {
            ulong res = 1;
            for (int i = 0; i < b; i++)
            {
                res *= (ulong)a;
            }
            return res;
        }
        static int s2i(String s)
        {
            return Convert.ToInt32(s);
        }
        static long s2l(String s)
        {
            return Convert.ToInt64(s);
        }
        static void RESULT(double res)
        {
            Console.WriteLine(res);
        }
        static void RESULT(long res)
        {
            Console.WriteLine(res);
        }
        static void RESULT(ulong res)
        {
            Console.WriteLine(res);
        }
        static void RESULT(int res)
        {
            Console.WriteLine(res);
        }
        static void RESULT(String res)
        {
            Console.WriteLine(res);
        }
        static String[] ReadLineAll(int count)
        {
            String[] res = new String[count];
            for (int i = 0; i < count; i++)
            {
                res[i] = Console.ReadLine();
            }
            return res;
        }

        static int[] s2iarray(String[] src)
        {
            int len = src.Length;
            int[] res = new int[len];
            for (int i = 0; i < len; i++)
            {
                res[i] = Convert.ToInt32(src[i]);
            }
            return res;
        }
        static long[] s2larray(String[] src)
        {
            int len = src.Length;
            long[] res = new long[len];
            for (int i = 0; i < len; i++)
            {
                res[i] = Convert.ToInt64(src[i]);
            }
            return res;
        }
        static ulong[] s2larray2(String[] src)
        {
            int len = src.Length;
            ulong[] res = new ulong[len];
            for (int i = 0; i < len; i++)
            {
                res[i] = Convert.ToUInt64(src[i]);
            }
            return res;
        }

     static   long  C(int n, int r)
        {
            if (n <= 1) return 0;
            if (r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
            long ans = 1;
            int i;

            for (i = 1; i <= r; i++)
            {
                ans *= n - r + i;
                ans /= i;
            }

            return ans;
        }
        static long C(long n, long r)
        {
            if (n <= 1) return 0;
            if (r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
            long ans = 1;
            int i;

            for (i = 1; i <= r; i++)
            {
                ans *= n - r + i;
                ans /= i;
            }

            return ans;
        }
        static ulong C(ulong n, ulong r)
        {
            if (n <= 1) return 0;
            if (r > n - r) r = n - r; // because C(n, r) == C(n, n - r)
            ulong ans = 1;
            ulong i;

            for (i = 1; i <= r; i++)
            {
                ans *= n - r + i;
                ans /= i;
            }

            return ans;
        }
    }
  
}


Measured memory_bytes: 89060