#include #include using namespace std; const int N=2e5+5; const int mod=1e9+7; int n,m,a[N],f[N],inv[N]; int read() { int res,f=1; char ch; while((ch=getchar())<'0'||ch>'9') if(ch=='-') f=-1; res=ch^48; while((ch=getchar())>='0'&&ch<='9') res=(res<<1)+(res<<3)+(ch^48); return res*f; } int main() { // freopen("ex_a4.in","r",stdin); int i,ans=0; n=read();m=read(); for(i=1;i<=n;i++) a[i]=read(); f[1]=1;inv[1]=1; for(i=2;i<=n;i++) { inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod; f[i]=1ll*f[i-1]*(m+i-1)%mod*inv[i-1]%mod; } for(i=1;i<=n;i++) ans=(ans+1ll*a[i]*f[i]%mod*f[n+1-i]%mod)%mod; printf("%d",ans); return 0; }