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

namespace ABC167
{
    public class Solve
    {
        public static void Main(string[] args)
        {
            new ABC_D();
        }
    }
    public class ABC_A
    {
        public ABC_A()
        {
            var s = Ex.Read;
            var t = Ex.Read;

            bool b = s.Length + 1 == t.Length;
            int i = 0;
            while (b && i < s.Length)
            {
                b &= s[i] == t[i];
                i++;
            }

            (b ? "Yes" : "No").Cw();
        }
    }
    public class ABC_B
    {
        public ABC_B()
        {
            var l = Ex.ReadLongArray();
            var a = l[0];
            var b = l[1];
            var c = l[2];
            var k = l[3];
            long ans = 0;

            if (k > 0)
            {
                ans += 1 * Math.Min(k, a);
                k -= a;
            }
            if (k > 0)
            {
                k -= b;
            }
            if (k > 0)
            {
                ans -= 1 * Math.Min(k, c);
                k -= c;
            }

            ans.Cw();
        }
    }
    public class ABC_C
    {
        long[][] arr;
        long n;
        long m;
        long x;
        long min = long.MaxValue;

        public ABC_C()
        {
            var l = Ex.ReadLongArray();
            n = l[0];
            m = l[1];
            x = l[2];

            arr = new long[n][];

            for (int i = 0; i < n; i++)
            {
                arr[i] = Ex.ReadLongArray();
            }


            long[] now = new long[m];
            dfs(0, 0, now);

            if (min == long.MaxValue)
            {
                min = -1;
            }

            min.Cw();
        }

        bool dfs(long t, int i, long[] now)
        {
            if (now.All(v => v >= x))
            {
                min = Math.Min(min, t);
                return true;
            }

            if (i >= n)
            {
                return false;
            }

            dfs(t, i + 1, now);


            for (int j = 0; j < m; j++)
            {
                now[j] += arr[i][j + 1];
            }
            t += arr[i][0];
            dfs(t, i + 1, now);

            for (int j = 0; j < m; j++)
            {
                now[j] -= arr[i][j + 1];
            }

            return false;
        }
    }
    public class ABC_D
    {
        long[] vi;
        long[] arr;
        long n;
        long k;

        public ABC_D()
        {
            var l = Ex.ReadLongArray();
            n = l[0];
            k = l[1];
            arr = Ex.ReadLongArray();
            vi = new long[n];

            long i = 0;
            long a = k;
            vi[i] = k;
            bool b = true;

            while (k > 0)
            {
                i = arr[i] - 1;
                k--;

                if (b && vi[i] > 0)
                {
                    //$"{(k % (vi[i] - k))} {(k / (vi[i] - k))} {(vi[i] - k)} {vi[i]} {k}".Cw();
                    k %= (vi[i] - k);
                    //$"{k}".Cw();
                    b = false;
                }
                vi[i] = k;
            }
            (i + 1).Cw();
        }
    }
    public class ABC_E
    {
        public ABC_E()
        {
        }
    }
    public class ABC_F
    {
        public ABC_F()
        {
        }
    }
    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }

        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static string yesno(this bool b) { return b ? "yes" : "no"; }
        public static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        public static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public static int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public static long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 38620