N,K=map(int,input().split()) A=list(map(int,input().split())) A.sort() count=0 for i in range(N): if K-A[i] >= 0: K-=A[i] count+=1 print(count,K)