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 itertools
def brute(arr, k):
    resultSubseq = []
    result = float('inf')
    N = len(arr)
    for combo in itertools.combinations(arr, k):
        subseq = list(combo)

        subseq1 = [subseq[i] for i in range(0, len(subseq), 2)]
        subseq2 = [subseq[i] for i in range(1, len(subseq), 2)]
        cand1 = max(subseq1)
        cand2 = max(subseq2)
        
        # print(subseq, subseq1, cand1, subseq2, cand2)   

        pickedSubseq = []
        if cand1 < cand2:
            cost = cand1
            pickedSubseq = subseq1
        else:
            cost = cand2
            pickedSubseq = subseq2

        if cost <= result:
            result = cost
            # resultSubseq = pickedSubseq
            resultSubseq = subseq 

    return result, resultSubseq

"""
Let S be a subsequence of array arr. 
Now, define cost(S) = min(max{S[i] | i is even}, max{S[i] | i is odd}). 
What is the lowest cost for all subsequences of length k for a given array arr?
(i.e. what subsequence S of length k minimizes cost(S))?

Binary search on cost? To do this, we need a fast way to figure out whether it's possible to achieve a cost of c.
Can I find a subsequence of length k where c is the maximum among even indices, while the maximum among odd indices is greater than c?


[5, 3, 4, 2, 6], k=3
is it possible to find cost lesser than 2?

[5, 3, 4, 2, 6]
 F  F  F  T  F      (arr[i] <= 2?)
is it possible to find .T.T.T ... or T.T.T.T ...?
This can be done in O(n).
This binary search algo can work in O(nlogn).


k even:
Find if k // 2 Trues are in the array, each seperated by at least 1 elem

k odd:
k // 2, k // 2 + 1

Find if k // 2 Trues are in arr[1:] or arr[:-1], each seperated by at least 1 elem.
Alternatively, find if k//2 + 1 Trues are in arr, each seperated by at least 1 elem.



"""

# def isPossibleCost(arr, k, cost):
#     bools = [num <= cost for num in arr]
#     atEvens = []
#     atOdds = []

#     for b in bools:
#         if b is True:
#             atEvens.append(b)
#             atOdds.append(b)
#         else:
#             if len(atEvens) % 2 == 0:
#                 atEvens.append(b)
#             if len(atOdds) % 2 == 1:
#                 atOdds.append(b)

#     return len(atEvens) >= k or len(atOdds) >= k

def isPossibleCost(arr, k, cost):
    numAtEvens = 0
    numAtOdds = 0

    for num in arr:
        if num <= cost:
            numAtEvens += 1
            numAtOdds += 1
        else:
            if numAtEvens % 2 == 0:
                numAtEvens += 1
            if numAtOdds % 2 == 1:
                numAtOdds += 1
        if numAtEvens >= k or numAtOdds >= k:
            return True

    return False

def soln(arr, k):
    left, right = min(arr), max(arr)
    result = 0
    while left <= right:
        mid = (left + right) // 2
        if isPossibleCost(arr, k, mid):
            result = mid
            right = mid - 1
        else:
            left = mid + 1
    return result 

"""
1 2 3 4, k=3
"""

def main():
    n, k = [int(x) for x in input().split()]
    arr = [int(x) for x in input().split()]
    
    # CHANGE
    # result, _ = brute(arr, k)
    result = soln(arr, k)

    print(result)

def test():
    # arr = [9, 3, 2, 3, 6]
    # k = 4
    # arr = [1, 2, 3, 4]
    # k = 3
    # arr = [9, 9, 6, 10, 6]
    # k = 5
    arr = [1, 3, 8, 9]
    k = 4
    b, picked = brute(arr, k)
    f = soln(arr, k)
    print(b, f)
    print(picked)

def randomTest():
    import random
    t = 100
    for i in range(1, t + 1):
        n = random.randint(2, 10)
        k = random.randint(2, n)
        arr = [random.randint(1, 10) for _ in range(n)]
        print(i, k, arr)
        # print(arr, k)
        b, picked = brute(arr, k)
        # print(f'answer: {b}, picked: {picked}')
        # print()
        f = soln(arr, k)
        if b != f:
            print('Broken!')
            print(b, f)
            return
        
def stressTest():
    import random
    t = 100
    # t = 1
    for i in range(1, t + 1):
        n = random.randint(2, 2*10**5)
        k = random.randint(2, n)
        arr = [random.randint(1, 10**9) for _ in range(n)]
        f = soln(arr, k)
        print(i, f)

main()
# test()
# randomTest()
# stressTest()
