eval"N,K,*A="+gets(p).split*?, z=0 (0..N).map{|i|A.combination(i){|a|n=a.sum n>K||n>z&&z=n}} p z