#include <iostream>
#include <bits/stdc++.h>


using namespace std;

short N = 0; // [0, 200000] 16bit
short k = 0; // [0, 200000] 16bit
int A[200000] = {0}; // [0, 10^9] 32 bit


long long func(short N, short k, int * T)
{
	long long f=0;

	if (k==0)
	{
		for(short i=0; i<N; i++)
		{
			f+=T[i];
		}
		return f;
	}
	else
	{
		for(short i=0; i<N; i++)
		{
			for(short j=i; j<N; j++)
			{
				f+=func(j-i+1, k-1, T+i);
			}
		}
	}

	return f;
}

int main(int atgc, char* argv[])
{
	cin >> N >> k;

	for (int i=0; i<N; i++)
	{
		cin >> A[i];
	}

	long long winner = func(N, k, A);

	int winner_final = winner % 1000000007;

	cout << winner_final << endl;

	return 0;
}