from itertools import accumulate n, k = map(int, input().split()) a = list(map(int, input().split())) a.sort() acc = list(accumulate(a)) cnt = 0 for i in range(n): if acc[i] <= k: cnt += 1 print(cnt, k - acc[cnt-1])