fn main() { const MOD: usize = 1_000_000_007; let [n, k]: [usize; 2] = { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); let mut iter = buf.split_whitespace(); [ iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), ] }; let a: Vec = { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); let iter = buf.split_whitespace(); iter.map(|x| x.parse().unwrap()).collect() }; let pow = |mut a, mut n| { let mut res = 1; while n > 0 { if n & 1 > 0 { res = res * a % MOD; } a = a * a % MOD; n >>= 1; } res }; let mut c = Vec::with_capacity(n); c.push(1); for i in 1..n { c.push(c[i - 1] * (k + i) % MOD * pow(i, MOD - 2) % MOD); } let mut ans = 0; for i in 0..n { ans = (ans + c[i] * c[n - 1 - i] % MOD * a[i] % MOD) % MOD; } println!("{}", ans); }