using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder_Beginner_Contest_167
{
    class D
    {
        static void Main(string[] args)
        {
            var nk = ReadLongArray(2);
            var n = (int)nk[0];
            var k = nk[1];
            var a = ReadIntArray(n);

            var currentCity = 1;

            var departFrom = new Dictionary<int, long>();

            for (long i = 1; i <= k; i++)
            {
                departFrom[currentCity] = i;
                var newCity = a[currentCity - 1];

                if (departFrom.TryGetValue(newCity, out var fromIdx))
                {
                    var cycleSize = i - fromIdx + 1;
                    var left = (k - i) % cycleSize;
                    i = k - left;
                    departFrom.Clear();
                    currentCity = newCity;
                }
                else
                {
                    departFrom[currentCity] = i;
                    currentCity = newCity;
                }
            }
            Console.WriteLine(currentCity);
#if HELLO
            Console.ReadKey();
#endif
        }

        private static List<int> ReadIntListFrom_StringSplit(string s)
        {
            return
                s.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToList();
        }

        ///////////////

        private static int[] ReadIntArray() => ReadIntArrayFrom_StringSplit(Console.ReadLine());

        private static int[] ReadIntArray(int size) => ReadIntArrayFrom_FixedSize(Console.ReadLine(), size);

        private static long[] ReadLongArray(int size) => ReadLongArrayFrom_FixedSize(Console.ReadLine(), size);

        private static int[] ReadIntArrayFrom_StringSplit(string s) =>
                s.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();


        private static int[] ReadIntArrayFrom_FixedSize(string s, int size)
        {
            var sLen = s.Length;
            var res = new int[size];
            var resIdx = 0;
            var start = 0;
            string ss;

            for (int i = 1; i <= sLen; i++)
            {
                if ((i == sLen || s[i] == ' '))
                {
                    ss = s.Substring(start, i - start);
                    {
                        res[resIdx++] = int.Parse(ss);
                        start = i + 1;
                    }
                }
            }
            return res;
        }

        private static long[] ReadLongArrayFrom_FixedSize(string s, int size)
        {
            var sLen = s.Length;
            var res = new long[size];
            var resIdx = 0;
            var start = 0;
            string ss;

            for (int i = 1; i <= sLen; i++)
            {
                if ((i == sLen || s[i] == ' '))
                {
                    ss = s.Substring(start, i - start);
                    {
                        res[resIdx++] = long.Parse(ss);
                        start = i + 1;
                    }
                }
            }
            return res;
        }

        //////////////////

        private static int ReadInt(string s) => int.Parse(s);

        private static int ReadInt() => int.Parse(Console.ReadLine());

        /////////

        static int Mod(int A, int n)
        {
            var a = A / n;
            if (A < 0)
            {
                return A - a * n + n;
            }
            else
            {
                return A - a * n;
            }
        }
    }
}


Measured memory_bytes: 50388