MOD = 10**9 + 7 N, M = gets.split.map(&:to_i) A = gets.split.map(&:to_i) A.unshift 0 class Integer def nCr(r); x = 1; (1..r).each { |i| x = x * (self + 1 - i) * i.pow(MOD - 2, MOD) % MOD }; x; end end # nCk(M + N - k, N - k + 1) x = (M + N - 1).nCr(N) # nCk(n, k) = n! / (k! * (n - k)!) # nCk(n - 1, k - 1) = nCk(n, k) * k / n ans = (1 .. N).sum { |k| y = x * A[k - 1] % MOD; x = x * (N - k + 1) * (M + N - k).pow(MOD - 2, MOD) % MOD; y } % MOD puts ans