eval"N,S,*P="+`dd`.split*?,;g=->f,t,s=0,r=[],h=(Hash.new{[]}){h[s]+=[r];(f...t).map{|i|g[i+1,t,s+P[i],r+[i+1],h]};h};L=g[N/2,N];g[0,N/2].map{|s,a|a.product(L[S-s]){|x,y|$*<