# TLE ... orz def kumi(m, list) if m == 0 return 1 end if list.size == 0 return 0 end n = 0 list = list.dup a = list.pop (m / a + 1).times do |i| n += kumi(m - a * i, list) end return n end n, m = gets.split.map &:to_i list = gets.split.map &:to_i puts kumi(m, list) % 1234567891