let () =
  let n, k = Scanf.scanf "%d %d\n" @@ fun a b -> a, b in
  let arr = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun d -> d in
  let rec f i x = if x = 1 then i else f (i+1) arr.(x-1) in
  let i = f 1 arr.(0) in
  let next = ref arr.(0) in
  for i = 0 to (k mod i) do
    next := arr.(!next - 1)
  done;
  print_int (!next + 1)