(N,K),A=$<.map{_1.split.map &:to_i} h=[] K.upto(N){|k|A.combination(k){h<<_1.sum<<_1.reduce(:*)}} p h.uniq.size