a,b= map(int, input().split()) c = list(map(int, input().split())) c=sorted(c) e=0 if c[0]>b: print(0,b) exit() for i in range(len(c)): e+=c[i] if e>=b: e-=c[i] break print(i,b-e)