Ashish has an array a of size n.

A subsequence of a is defined as a sequence that can be obtained from a by deleting some elements (possibly none), without changing the order of the remaining elements.

Consider a subsequence s of a. He defines the cost of s as the minimum between: 

  * The maximum among all elements at odd indices of s. 
  * The maximum among all elements at even indices of s. 



Note that the index of an element is its index in s, rather than its index in a. The positions are numbered from 1. So, the cost of s is equal to min(max(s_1, s_3, s_5, …), max(s_2, s_4, s_6, …)).

For example, the cost of \{7, 5, 6\} is min( max(7, 6), max(5) ) = min(7, 5) = 5.

Help him find the minimum cost of a subsequence of size k.

Input

The first line contains two integers n and k (2 ≤ k ≤ n ≤ 2 ⋅ 10^5) — the size of the array a and the size of the subsequence.

The next line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^9) — the elements of the array a.

Output

Output a single integer — the minimum cost of a subsequence of size k.

Examples

Input


4 2
1 2 3 4


Output


1

Input


4 3
1 2 3 4


Output


2

Input


5 3
5 3 4 2 6


Output


2

Input


6 4
5 3 50 2 4 5


Output


3

Note

In the first test, consider the subsequence s = \{1, 3\}. Here the cost is equal to min(max(1), max(3)) = 1.

In the second test, consider the subsequence s = \{1, 2, 4\}. Here the cost is equal to min(max(1, 4), max(2)) = 2.

In the fourth test, consider the subsequence s = \{3, 50, 2, 4\}. Here the cost is equal to min(max(3, 2), max(50, 4)) = 3.
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.concurrent.ConcurrentSkipListMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main
{	
	
   static long mod=(long)(1e+9 + 7);
	
   //static long mod=(long)998244353;
   static int[] sieve;
   
   static ArrayList<Integer> primes;
   static PrintWriter out;
   static fast s;
   static StringBuilder fans;
   
   static int x_dir[];
   static int y_dir[];
   
   static class Pair
   {
       int ind;
       long val;
       
       public Pair(int x,long y)
       {
      	 this.ind=x;
      	 this.val=y;
       }
   }
   
   static class comp implements Comparator<Pair>
   	{
   		public int compare(Pair a,Pair b)
   		{
   			if(a.val<b.val)return -1;
   			if(a.val>b.val)return 1;
   			if(a.val==b.val)
   				{
   					if(a.ind<b.ind) return -1;
   					if(a.ind>b.ind) return 1;
   					return 0;
   				}
   			return 0;
   		}
   	}
   
   public static void union(int[] parent,int[] size,int root_f,int root_t)
      {
          if(size[root_f]<=size[root_t]) {parent[root_f]=root_t;size[root_t]+=size[root_f];return;}
          if(size[root_f]>size[root_t]) {parent[root_t]=root_f;size[root_f]+=size[root_t];return;}
      }
      
      public static int find(int[] parent,int[] rank,int f) 
      {
          if(f!=parent[f])
               parent[f]=find(parent,rank,parent[f]);
          return parent[f];
      }
      
   public static long solve(ArrayList<Pair> a,int k,int n)
   {
   	long max=Long.MIN_VALUE;
   	
   	int visited[]=new int[n];
   	int parent[]=new int[n];
   	int rank[]=new int[n];
   	int size[]=new int[n];
   	
   	for(int i=0;i<n;i++) {parent[i]=i; rank[i]=1; size[i]=1;}
   	int cnt=0;
   	
   	for(Pair p:a)
   		{
   			long val=p.val;
   			int i=p.ind;
   			
   			if((i-1)>=0 && visited[i-1]==1 && (i+1)<n && visited[i+1]==1)
   				{
   					int left_par=find(parent,rank,i-1); int left_size=size[left_par];
   					int right_par=find(parent,rank,i+1); int right_size=size[right_par];

						union(parent,size,left_par,right_par);
						union(parent,size,parent[left_par],i);
						visited[i]=1;
						
   					if(left_size%2==0 && right_size%2==0)
   						{
   							cnt++;
   							max=Math.max(max, val);
   						}
   				}
   			else if((i-1)>=0 && visited[i-1]==1)
   				{
   					int left_par=find(parent,rank,i-1); int left_size=size[left_par];
						union(parent,size,left_par,i);
						visited[i]=1;
						
   					if(left_size%2==0)
   						{
   							cnt++;
   							max=Math.max(max, val);
   						}
   				}
   			else if((i+1)<n && visited[i+1]==1)
   				{
   					int right_par=find(parent,rank,i+1); int right_size=size[right_par];
						union(parent,size,right_par,i);
						visited[i]=1;
						
   					if(right_size%2==0)
   						{
   							cnt++;
   							max=Math.max(max, val);
   						}
   				}
   			else
   				{
   					cnt++;
   					max=Math.max(max, val);
   					visited[i]=1;
   				}
   			
   			if(cnt==k) return max;
   		}
   	
   	return Long.MAX_VALUE;
   }
   
   public static void solve()
   {
       int n=s.nextInt();
       int k=s.nextInt();
       long a[]=new long[n];
       for(int i=0;i<n;i++) a[i]=s.nextLong();
       
       ArrayList<Pair> arr=new ArrayList<Pair>();
       
       if(k%2==1)
      	 {
			       for(int i=1;i<a.length-1;i++)
			      	 arr.add(new Pair(i,a[i]));
			       Collections.sort(arr,new comp());
			       long ans1=solve(arr,k/2,n);
			       
			       arr.clear();
			       for(int i=0;i<a.length;i++)
			      	 arr.add(new Pair(i,a[i]));
			       Collections.sort(arr,new comp());
			       long ans2=solve(arr,(k+1)/2,n);
			       fans.append(Math.min(ans1, ans2));         
      	 }
       else
      	 {
      		 for(int i=0;i<a.length-1;i++)
		      	 arr.add(new Pair(i,a[i]));
		       Collections.sort(arr,new comp());
		       long ans1=solve(arr,k/2,n);
		      
//		       for(Pair add:arr) System.out.print(add.ind+" ");
//		       System.out.println();
		       
		       arr.clear();
		       for(int i=1;i<a.length;i++)
		      	 arr.add(new Pair(i,a[i]));
		       Collections.sort(arr,new comp());
		       long ans2=solve(arr,k/2,n);
		       
		       fans.append(Math.min(ans1, ans2)); 
      	 }
   }
   
   public static void main(String[] args) throws java.lang.Exception
   {	  	
	     s = new fast();
	     
	     out=new PrintWriter(System.out);
	     fans=new StringBuilder("");
		  
	     int t=1;
	     
	     while(t>0)
	    	 {
	    		 solve();
	    		 t--;
	    	 }
	    
	    out.println(fans);
	    out.close();
   }
  
 
 
static class fast {   
	
	   private InputStream i;
		private byte[]  buf = new byte[1024];
		private int curChar;
		
		private int numChars;
		
		//Return floor log2n
		public static long log2(long bits) // returns 0 for bits=0
			{
			    int log = 0;
			    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
			    if( bits >= 256 ) { bits >>>= 8; log += 8; }
			    if( bits >= 16  ) { bits >>>= 4; log += 4; }
			    if( bits >= 4   ) { bits >>>= 2; log += 2; }
			    return log + ( bits >>> 1 );
			}
		
		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;	   
			   int n=a.length;
			   
			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;
			   
			   if(index==-1) return false;
			   i=index;
 
			  
			   for(j=i+1;j<n && a[i]<a[j];j++);
 
			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;
			   	   
			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }
			   
			   return true;
		   }
		   
		public static void sieve(int size)
		{
			sieve=new int[size+1];
			
			primes=new ArrayList<Integer>();
			
			sieve[1]=1;
			
			for(int i=2;i*i<=size;i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
				 }
			}
			
			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}
		
		public static long pow(long a, long p){
		    long o = 1;
		    for(; p>0; p>>=1){
		        if((p&1)==1)o = mul(o, a);
		        a = mul(a, a);
		    }
		    return o;
		}
		
		public static long add(long... a){
		    long o = 0;
		    for(long x:a)o = (o+mod+x)%mod;
		    return o;
		}
		
		public static long mul(long... a){
		    long p = 1;
		    for(long x:a)p = (mod+(p*x)%mod)%mod;
		    return p;
		}
		
		public static long mod_inv(long n)
		{
			return pow(n,mod-2);
		}
		   
		public long gcd(long r,long ans)
		{
			if(r==0) return ans;
			return gcd(ans%r,r);
		}
		
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
	}	
}