def lscan;gets.split.map(&:to_i); end n,k = lscan aa = lscan set = {} k.upto(n) do |m| aa.combination(m) do |e| set[e.reduce(:+)] = true set[e.reduce(:*)] = true end end p set.size