using System;
using System.Collections.Generic;
using System.Collections;
using System.Linq;
namespace Atcoder_0404
{
    class Program
    {
        static void Main(string[] args)
        {
            var NK = GetInput_long();
            long _count_town = NK[0];
            long _count_worp = NK[1];
            var _worpNext = GetInput_long();
            List<long> _worpedPosList = new List<long>();
            int[] _worped = new int[_count_town];

            long next = _worpNext[0]-1;
            _worpedPosList.Add(0);
            bool enb = false;
            while (_worped[next]==0)//同じところに飛ぶまでの間
            {
                if (_worpedPosList.Count == _count_worp)
                {
                    enb = true;
                    break;
                }
                _worpedPosList.Add(next);
                _worped[next] = 1;
                next = _worpNext[next]-1;
            }
            if (enb)
            {
                Console.WriteLine(next+1);
                //GetInput_string();
                return;
            }

            long roopStart = _worpedPosList.IndexOf(next);
            long roopCount = _worpedPosList.Count-roopStart;
            long targetIndex = (_count_worp-roopStart) % roopCount;
            long result = _worpedPosList[(int)(targetIndex+roopStart)]+1;
            Console.WriteLine(result);
            //GetInput_string();
        }

        
        #region input
        

        static string[] GetInput_string()
        {
            var input = Console.ReadLine().Split(' ');
            return input;
        }

        static int[] GetInput_int()
        {
            var input = GetInput_string();
            var result = new int[input.Length];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = int.Parse(input[i]);
            }
            return result;
        }
        static long[] GetInput_long()
        {
            var input = GetInput_string();
            var result = new long[input.Length];
            for (int i = 0; i < result.Length; i++)
            {
                result[i] = long.Parse(input[i]);
            }
            return result;
        }
        #endregion
        #region sonota
        static void Swap_array<T>(T[] target, int a, int b)
        {
            T temp = target[a];
            target[a] = target[b];
            target[b] = temp;
        }
        static void Swap_list<T>(List<T> target, int a, int b)
        {
            T temp = target[a];
            target[a] = target[b];
            target[b] = temp;
        }
        /// <summary>
        /// 最大公約数
        /// </summary>
        public static int GCD(int a, int b)
        {

            /* 自然数 a > b を確認・入替 */
            if (a < b)
            {
                int tmp = a;
                a = b;
                b = tmp;
            }

            /* ユークリッドの互除法 */
            int r = a % b;
            while (r != 0)
            {
                a = b;
                b = r;
                r = a % b;
            }
            return b;
        }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        public static int LCM(int a, int b)
        {
            int x = a * b;
            b = GCD(a, b);
            return x / b;

        }
        #endregion

        static long mod = 1000000000 + 7;
    }

}

Measured memory_bytes: 47256