open System let R T = stdin.ReadLine()|> T let RS T = stdin.ReadLine().Split()|>Array.map T let R2 T U = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U) let R3 T U V = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V) let R4 T U V W = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W) let R5 T U V W X = RS string|>fun c-> (c.[0]|>T),(c.[1]|>U),(c.[2]|>V),(c.[3]|>W),(c.[4]|>X) [] let main argv = let N,K = R2 int int64 let A = RS int64 let MOD = 1000000007L let rec modpow (x:int64) n = match n with | 0 -> 1L | 1 -> x%MOD | _ when n%2=0 -> ((modpow ((x*x)%MOD) (n/2)))%MOD | _ -> (x*(modpow x (n-1)))%MOD let comb = [|for i in [1..N] do yield 1L|] for i in [1..(N-1)] do comb.[i] <- ((comb.[i-1]*(K+(i|>int64)))%MOD*(modpow (i|>int64) 1000000005))%MOD [for i in [0..(N-1)] do yield ((comb.[i]*comb.[N-1-i])%MOD*A.[i])%MOD] |>List.reduce (fun a b -> (a+b)%MOD) |>stdout.WriteLine 0