#include <iostream>
#include <math.h>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char** argv) {
	int n,k;
	cin>>n>>k;
	int a[n+1];
	a[0]=0;
	for(int i = 1;i<=n;i++) cin>>a[i];
	if(k == 0){
		for(int i = 1; i<=n; i++) a[0] = a[0] + a[i]; 
		if(a[0]>(pow(10,9) +7)) a[0]-=pow(10,9) +7;
		cout<<a[0];
	}
	else{
		for(int i = 1; i<=n; i++) a[0] = a[0] +a[i] * i * (n+1-i)*k;
		if(a[0]>(pow(10,9) +7)) a[0]-=pow(10,9) +7;
		cout<<a[0];
		}
	
	return 0;
}