#include <iostream>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    unsigned a[n],max=1000000007;
    for(int i=0;i<n;i++)
        cin>>a[i];
    
    unsigned f[n];
    f[0]=a[0];
    for(int i=1;i<n;i++)
        f[i]=(f[i-1]+a[i])%max;

/*
    for(int ktemp=1;ktemp<=k;ktemp++)
    {
        unsigned 
    }
*/
    cout<<f[n-1]<<endl;
    return 0;
}