using System.Collections;
using System.Text;
using System.Threading.Tasks;
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System;
using System.Numerics;



class Program
{
    #region Reader
    //static Vector2Int ReadVec2Int
    //{
    //    get
    //    {
    //        string[] s = Console.ReadLine().Split(' ');
    //        return new Vector2Int(int.Parse(s[0]), int.Parse(s[1]));
    //    }
    //}
    //static Vector2Int[] ReadVec2Ints(int n)
    //{
    //    List<Vector2Int> list = new List<Vector2Int>();
    //    for (int i = 0; i < n; ++i)
    //    {
    //        var ab = ReadInts;
    //        list.Add(new Vector2Int(ab[0], ab[1]));
    //    }
    //    return list.ToArray();
    //}
    //static HashSet<Vector2Int> ReadVec2IntHash(int n)
    //{
    //    HashSet<Vector2Int> hash = new HashSet<Vector2Int>();
    //    for (int i = 0; i < n; ++i)
    //    {
    //        var ab = ReadInts;
    //        hash.Add(new Vector2Int(ab[0], ab[1]));
    //    }
    //    return hash;
    //}
    static string ReadStr => Console.ReadLine();
    static string[] ReadStrs => Console.ReadLine().Split(' ');
    static int ReadInt => Convert.ToInt32(Console.ReadLine());
    static int[] ReadInts => Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
    static long ReadLong => Convert.ToInt64(Console.ReadLine());
    static long[] ReadLongs => Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray();
    static long[,] ReLongMatrix(int r, int c)
    {
        var mat = new long[r, c];
        for (int i = 0; i < r; ++i)
        {
            var x = ReadLongs;
            for (int j = 0; j < c; ++j)
            {
                mat[i, j] = x[j];
            }
        }
        return mat;
    }
    static Tuple<string, string>[] ReTupleStr(int n)
    {
        List<Tuple<string, string>> list = new List<Tuple<string, string>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadStrs;
            list.Add(new Tuple<string, string>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<long, long>[] ReTupleLong(int n)
    {
        List<Tuple<long, long>> list = new List<Tuple<long, long>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadLongs;
            list.Add(new Tuple<long, long>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<int, int>[] ReadTupleInt(int n)
    {
        List<Tuple<int, int>> list = new List<Tuple<int, int>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadInts;
            list.Add(new Tuple<int, int>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Tuple<double, double>[] ReTupleDouble(int n)
    {
        List<Tuple<double, double>> list = new List<Tuple<double, double>>();
        for (int i = 0; i < n; ++i)
        {
            var ab = ReadLongs;
            list.Add(new Tuple<double, double>(ab[0], ab[1]));
        }
        return list.ToArray();
    }
    static Dictionary<int, HashSet<int>> ReAdjacencyList(int N, int M)
    {
        Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
        for (int i = 0; i <= N; ++i)
        {
            dict.Add(i, new HashSet<int>());
        }
        for (int i = 0; i < M; ++i)
        {
            var ab = ReadInts;
            dict[ab[0]].Add(ab[1]);
            dict[ab[1]].Add(ab[0]);
        }
        return dict;
    }
    #endregion
    static void Swap<T>(ref T a, ref T b)
    {
        T temp = a;
        a = b;
        b = temp;
    }
    static int mod = (int)Pow(10, 9) + 7;

    public static long GetInv(long a, long mod = 1000000007)
    {
        return PowerMod(a, mod - 2, mod);
    }
    public static long Combination(long a, long b, long mod = 1000000007)
    {
        if (b < 0 || b > a) return 0;
        if (b > a / 2) b = a - b;
        long numerator = Factorial(a, mod);
        long denominator = (Factorial(b, mod) * Factorial(a - b, mod)) % mod;

        return (numerator * GetInv(denominator, mod)) % mod;
    }
    public static long Factorial(long n, long mod = 1000000007)
    {
        if (n == 0) return 1;
        if (n == 1) return 1;
        long ans = n;
        for (int i = 2; i < n; i++)
        {
            ans = (ans * i) % mod;
        }

        return ans;
    }
    private static long PowerMod(long a, long n, long mod = 1000000007)
    {
        if (n == 0) return 1;
        if (n == 1) return a;

        long p = PowerMod(a, n / 2, mod);
        if (n % 2 == 1) return ((p * p) % mod * a) % mod;
        else return (p * p) % mod;
    }



    /// <summary>
    /// 最小公倍数
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static long Lcm(long a, long b)
    {
        return a * b / Gcd(a, b);
        //return ( ((a * b)%mod) * GetInv( Gcd(a, b) ,mod ) )%mod;
    }

    /// <summary>
    /// 最大公約数
    /// </summary>
    /// <param name="a"></param>
    /// <param name="b"></param>
    /// <returns></returns>
    public static long Gcd(long a, long b)
    {
        if (a < b)
            // 引数を入替えて自分を呼び出す
            return Gcd(b, a);
        while (b != 0)
        {
            var remainder = a % b;
            a = b;
            b = remainder;
        }
        return a;
    }

    static void Main()
    {
        long[] NK = ReadLongs;
        int[] As = ReadInts;

        for (int i = 0; i < As.Length; i++)
        {
            As[i]--;
        }

        List<int> move = new List<int>() {0 };
        bool[] done = new bool[As.Length];
        done[0] = true;
        int current = 0;
        int last = -1;
        while (true)
        {
            if (done[As[current]])
            {
                last = As[current];
                break;
            }
            move.Add(As[current]);
            done[As[current]] = true;
            current = As[current];
        }

        int before = 0;
        int after = 0;

        for (int i = 0; i < move.Count; i++)
        {
            if (move[i] == last) break;
            before++;
        }

        after = move.Count - before;
        int ans = 0;

        if (NK[1] - before < 0)
        {
            ans = move[(int)NK[1]];
        }
        else
        {
            ans = move[before+(int)((NK[1] - before) % after)];
        }

        WriteLine(ans+1);
    }

}


Measured memory_bytes: 44928