N,S = list(map(int,input().split())) S -= 1 A = list(map(int,input().split())) A.sort(reverse=True) SUM = 0 now = 0 for i in range(N): if(SUM + A[i] > S): print(A[i]) exit() SUM += A[i] now += 1 print(1)