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