//  [rust]
#![allow(dead_code)]
use crate::doubling::doubling;
use crate::extra::VecExtra;
use crate::scanner::Scanner;
fn main() {
    let mut scan = Scanner::new();
    let n = scan.read::<usize>();
    let k = scan.read::<i64>();
    let a = scan.readn::<usize>(n).map(|x| x - 1);
    let ret = doubling(&a, 64, k);
    println!("{}", ret[0] + 1);
}
mod doubling {
    pub fn doubling(mapper: &[usize], depth: usize, k: i64) -> Vec<usize> {
        let mut dbl = vec![vec![0; mapper.len()]; depth];
        for i in 0..mapper.len() {
            dbl[0][i] = mapper[i];
        }
        for i in 0..depth - 1 {
            for j in 0..mapper.len() {
                dbl[i + 1][j] = dbl[i][dbl[i][j]];
            }
        }
        let mut ret = vec![0; mapper.len()];
        for i in 0..ret.len() {
            let mut cur = i;
            for rank in 0..depth {
                if (k >> rank as i64) & 1 == 1 {
                    cur = dbl[rank][cur];
                }
            }
            ret[i] = cur;
        }
        ret
    }
}
mod scanner {
    use std::io::{stdin, BufReader, Bytes, Read, Stdin};
    use std::str::FromStr;
    pub struct Scanner {
        buf: Bytes<BufReader<Stdin>>,
    }
    impl Scanner {
        pub fn new() -> Scanner {
            Scanner {
                buf: BufReader::new(stdin()).bytes(),
            }
        }
        pub fn read_next<T: FromStr>(&mut self) -> Option<T> {
            let token = self
                .buf
                .by_ref()
                .map(|c| c.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect::<String>();
            token.parse::<T>().ok()
        }
        pub fn read<T: FromStr>(&mut self) -> T {
            self.read_next().unwrap()
        }
        pub fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.read::<T>()).collect()
        }
        pub fn chars(&mut self) -> Vec<char> {
            self.read::<String>().chars().collect()
        }
    }
}
mod extra {
    use std::iter::{FromIterator, Sum};
    pub trait VecExtra<T> {
        fn map<B, F>(&self, f: F) -> Vec<B>
        where
            F: FnMut(T) -> B;
        fn filter<P>(&self, predicate: P) -> Vec<T>
        where
            P: FnMut(&T) -> bool;
        fn filter_map<B, F>(&self, f: F) -> Vec<B>
        where
            F: FnMut(T) -> Option<B>;
        fn any<P>(&self, predicate: P) -> bool
        where
            P: FnMut(&T) -> bool;
        fn all<P>(&self, predicate: P) -> bool
        where
            P: FnMut(&T) -> bool;
        fn sum<S>(&self) -> S
        where
            S: Sum<T>;
        fn enumerate(&self) -> Vec<(usize, T)>;
        fn to<B: FromIterator<T>>(&self) -> B;
    }
    impl<T: Clone> VecExtra<T> for Vec<T> {
        fn map<B, F>(&self, f: F) -> Vec<B>
        where
            F: FnMut(T) -> B,
        {
            self.iter().cloned().map(f).collect()
        }
        fn filter<P>(&self, predicate: P) -> Vec<T>
        where
            P: FnMut(&T) -> bool,
        {
            self.iter().cloned().filter(predicate).collect()
        }
        fn filter_map<B, F>(&self, f: F) -> Vec<B>
        where
            F: FnMut(T) -> Option<B>,
        {
            self.iter().cloned().filter_map(f).collect()
        }
        fn any<P>(&self, predicate: P) -> bool
        where
            P: FnMut(&T) -> bool,
        {
            self.iter().any(predicate)
        }
        fn all<P>(&self, predicate: P) -> bool
        where
            P: FnMut(&T) -> bool,
        {
            self.iter().all(predicate)
        }
        fn sum<S>(&self) -> S
        where
            S: Sum<T>,
        {
            Sum::sum(self.iter().cloned())
        }
        fn enumerate(&self) -> Vec<(usize, T)> {
            self.iter().cloned().enumerate().collect()
        }
        fn to<B: FromIterator<T>>(&self) -> B {
            self.iter().cloned().collect()
        }
    }
    pub trait StringExtra {
        fn to_chars(self) -> Vec<char>;
    }
    impl StringExtra for String {
        fn to_chars(self) -> Vec<char> {
            self.chars().collect()
        }
    }
}