MOD = 1_000_000_007 n, k = gets.split.map &:to_i a = gets.split.map &:to_i comb = [0] * (n + 1) comb[0] = 1 (1..n).each { |i| comb[i] = comb[i - 1] * (i + k) * i.pow(MOD - 2, MOD) % MOD } puts a.each_with_index.sum { |v, i| v * comb[i] * comb[n - i - 1] % MOD } % MOD