#include<iostream>
#include<vector>
#include<algorithm>


using namespace std;

int v = 0, l, n, sizeVect, j = 0,pK;
long long int S;

vector<long long int> copyA;

long long int suma_vektora(vector<long long int> A) {

	long long int s = 0;

	for (int i = 0;i < A.size();i++) {
		s += A[i];
	}

	return s;
}

long long int funkcija(vector<long long int> A, int k) {


	if (v == 0) {
		sizeVect = A.size(),l = 0, n = A.size()-1,v++,pK = k;
		S = 0;
		copyA = A;
	}

	if(k == 0)
	j++;

	if (k > 0) {
		funkcija(copyA, k-1);
	}

	if (j == sizeVect*(sizeVect+1)/2+pK) {
		return S;
	}
	
	vector<long long int> B = { copyA.begin() + l,copyA.end() - n };

	if (j >= 1 && n != 0) {
		n--;
		goto skok;
	}

	if (n==0) {
		l++;
		n = sizeVect - l - 1;	
	}
	
    skok:

	if (k == 0) {
		S += suma_vektora(B);
		funkcija(copyA, k);		
	}	
	
}

int main()
{
	int n, k;
	vector<long long int> A;
	

	cin >> n >> k;

	for (int i = 0;i < n;i++) {
		long long int c;
		cin >> c;
		A.push_back(c);
	}

	long long int resenje = funkcija(A, k);
	long long int ispis = resenje % 1000000007;
	cout << ispis;
}