n, k = map(int, input().split()) a = list(map(int, input().split())) a = sorted(a) c = 0 for i in a: k -= i if k < 0: k += i break else: c += 1 print(c, k)