program BUG;
var N,k,i,win,sum:LongInt; a:array[1..200001] of LongInt;

begin
read(N,k);
for i:=1 to N do
read(a[i]);
sum:=0;
for i:=1 to N do
sum:=sum+a[i]*i*(n+1-i);
win:=sum mod(1000000000+7);
write(win);
end.