import sys input = sys.stdin.readline from bisect import bisect_left N,K=map(int,input().split()) A=list(map(int,input().split())) if N==1: print(A[0]) exit() A.sort() B=A[:N//2] C=A[N//2:] X=[0] for b in B: Y=[] for x in X: Y.append(x+b) X=X+Y X2=[0] for b in C: Y=[] for x in X2: Y.append(x+b) X2=X2+Y X.sort() X2.sort() OK=-40*10**9 NG=40*10**9 while OK=K: OK=mid else: NG=mid print(OK)