n,k=map(int,input().split()) a=list(map(int,input().split())) a.sort() s=0 for i in range(n): if a[i]<=k: k-=a[i] s+=1 print(s,k)