using System;
using System.Collections.Generic;
using System.Linq;

namespace x
{
    class Program
    {
        static void Main(string[] args)
        {
            var vals = IOUtils.ReadLongs();
            //var townCount = vals[0];
            var telCount = vals[1];

            var moveToDic = IOUtils.ReadInts()
                                   .Select((n,i) => new { moveTo = n, no = i + 1})
                                   .ToDictionary(a => a.no, a => a.moveTo);
            
            var accessed = new List<int>(){ 1 };
            var accessedSet = new HashSet<int>() { 1 };
            var currentTownNo = 1;
            var loopStartIndex = -1;
            for (long i = 0; i < telCount; i++)
            {
                var next = moveToDic[currentTownNo];
                if (accessedSet.Contains(next))
                {
                    var idx = accessed.IndexOf(next);
                    loopStartIndex = idx;
                    break;
                }

                accessed.Add(next);
                accessedSet.Add(next);
                currentTownNo = next;
            }

            if (loopStartIndex == -1)
            {
                System.Console.WriteLine(currentTownNo);
                return;
            }
            var beforeLoopCount = loopStartIndex;
            var loopSetLength = accessed.Count - loopStartIndex;


            var rest = telCount - beforeLoopCount;
            var pos = accessed[loopStartIndex];
            rest = rest % loopSetLength;

            for (int i = 0; i < rest; i++)
            {
                pos = moveToDic[pos];
            }

            System.Console.WriteLine(pos);
        }
    }
    
    static class IOUtils
    {
        public static (int a, int b) Read2Ints()
        {
            var vals = ReadInts();
            return (vals[0], vals[1]);
        }
        public static (int a, int b, int c) Read3Ints()
        {
            var vals = ReadInts();
            return (vals[0], vals[1], vals[2]);
        }
        public static IEnumerable<int[]> ReadIntLines(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return ReadInts();
            }
        }
        public static IEnumerable<long[]> ReadLongLines(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return ReadLongs();
            }
        }
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        public static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }
        public static ulong ReadUlong()
        {
            return ulong.Parse(Console.ReadLine());
        }
        public static int[] ReadInts()
        {
            return Console.ReadLine().Split(' ').Select(v => int.Parse(v)).ToArray();
        }
        public static long[] ReadLongs()
        {
            return Console.ReadLine().Split(' ').Select(v => long.Parse(v)).ToArray();
        }

        public static void WriteNums(params int[] nums)
        {
            Console.WriteLine(string.Join(" ", nums));
        }
    }
}


Measured memory_bytes: 58548