#include <bits/stdc++.h>
using namespace std;
unsigned long long int ucitaj()
	{
		unsigned long long int rez=0;
		char ch;
		ch=getchar();
		while (true)
		{
			if (ch>='0' or ch<='9')break;
			ch=getchar();
		}
		rez=(ch-'0');
		while (true)
		{
			ch=getchar();
			if (ch<'0' or ch>'9') break;
			rez=rez*10+(ch-'0');
		}
		return rez;
	}
void bug(unsigned long long int A[],unsigned long long int n,unsigned long long int k,unsigned long long int *pk,unsigned long long int *ps)
{
	if (k==0)
	{
		for (unsigned long long int i=0;i<n;i++)
		{
			*ps=*ps+A[i];
		}
	}
	else
	{
		*pk=*pk-1;
		unsigned long long int B[200005];
		for (unsigned long long int i=0;i<n;i++)
		{
			unsigned long long int l=0;
			for (unsigned long long int j=i;j<n;j++)
			{
			 	B[l]=A[j];
				l=l+1;			
				bug(B,l,*pk,pk,ps);
			}
		}
	}
} 
int main()
{
	unsigned long long int A[200005],n,k,i,s,*ps,*pk;
	s=0;
	ps=&s;
	pk=&k;
	n=ucitaj();
	k=ucitaj();
	for (i=0;i<n;i++)
	{
		A[i]=ucitaj();
	}
	bug(A,n,k,&k,&s);
	s=s%1000000007;
	cout<<s;
}