#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    ll n,k;
    cin>>n>>k;
    ll a[n];
    for(ll i=0;i<n;i++)cin>>a[i];
    ll s=a[0];
    for(int i=1;i<n;i++) s=(s+a[i])-(s+a[i])/(1000000000+7);
    cout<<s;
}