a,b=map(int,input().split())
l=[]
for i in range(a):
l.append(int(input()))
s=sum(l)
#print(f"s={s}")
if s < b*2:
out2=b
out1=s-out2
print(f"{out1} {out2}")
elif s%2==1:
s-=1
print(f"{s//2} {s//2+1}")
else:
print(f"{s//2} {s//2}")