n,k=map(int,input().split()) a=sorted(list(map(int,input().split()))) cnt=0 for i in range(n): if k>=a[i]: k-=a[i] cnt+=1 else: break print(cnt,k)