N, K = map(int, input().split())
A = sorted(list(map(int, input().split())))

cnt = 0
for i in A:
    if i <= K:
        K -= i
        cnt += 1
    else:
        break
print(cnt, K)