k=int(input().split()[1]) a=sorted(map(int,input().split())) i=0 while k>a[i]:k-=a[i];i+=1 print(*[(i,k),(i+1,0)][k==a[i]])