N,K=map(int,input().split()) A=list(map(int,input().split())) A.sort() c,s=0,0 for a in A: if s+a<=K: s+=a c+=1 print(c,K-a)