n,m = map(int,input().split()) v = 0 for i in sorted(map(int,input().split())): m -= i print(m) if m >= 0: v += 1 print(v)