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