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