n, k = map(int, input().split()) a = sorted(list(map(int, input().split()))) #print(a, k) i = 0 s = 0 while i < n and s + a[i] <= k: s += a[i] i += 1 print(i, k - s)