#include <stdio.h>
#include <stdlib.h>

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    long long *a=(long long*)malloc(n*sizeof(long long));
    for (int i=0;i<n;i++) scanf("%lld",&a[i]);
    long long suma=0;
    for (int i=0;i<n;i++)
    {
        for (int j=i;j<n;j++)
        {
            suma+=a[j]*(n-j);
        }
    }
    printf("%lld",suma%(1000000007));
}