eval"N,M,*C="+gets(p).split*?, p C.sort.index{|n|0>M-=n}||N