using System;
using System.Collections;
using System.Collections.Generic;
       class Program
{
    static void Main(string[] args)
    {
            string[] brs = Console.ReadLine().Split();
            int n = int.Parse(brs[0]);
            int k = int.Parse(brs[1]);
            brs = Console.ReadLine().Split();
            int[] karte = new int[brs.Length];
            for (int i = 0; i < n; i++)
            {
                karte[i] = int.Parse(brs[i]);
            }
            if(k+1 != karte.Length)
            {
                Console.WriteLine(karte[k + 1)] ;
            }
            else
            {
                Console.WriteLine(karte[0]);
            }
            
        }
    }