#include <iostream>
using namespace std;

int main(int argc, const char * argv[]) {
    long long unsigned int N,k;
    cin>>N>>k;
    long long unsigned int A[N],sum=0;
    for (auto i =0; i < N; i ++)
    {
        cin>>A[i];
    }
    
    if (k==0)
    {
    for (auto i =0; i < N; i ++)
    {
        sum= sum + A[i];
    }
    }
    else
    {
        for (auto i = 1; i <=N; i ++)
        {
            sum= sum + A[i-1]*(N-i+1)*i;
            
        }
        sum=sum*k;
        
    }
    cout<<sum%1000000007<<endl;
    return 0;
}