from collections import * from itertools import * from functools import * from heapq import * import sys,math input = sys.stdin.readline N,M = map(int,input().split()) A = [int(input()) for _ in range(N)] a0 = A[0] A = A[1:] A.sort() A = [a0] + A def is_ok(i): threshold = A[i]+A[0] X = [] for j in range(1,N): if j!=i: X.append(A[j]) X.sort(reverse=True) v = deque(X) cnt = 0 while v: x = v.popleft() while v: y = v.pop() if x+y>threshold: cnt += 1 break return cnt1: mid = (y+x)//2 if is_ok(mid): y = mid else: x = mid print(A[y])