#include <iostream>

using namespace std;

unsigned long long int funkcija(int A[200000], int N, int k)
{
	if (k == 0)
	{
		int sum[11] = { 0,0,0,0,0,0,0,0,0,0,0 };
		unsigned long long int test_br;
		for (int i = 0;i < N;i++)
		{
			sum[0] += A[i];
			for (int j = 0;j < 10;j++)
			{
				if (sum[j] / 10 > 0)
				{
					sum[j + 1] += sum[j] / 10;
					sum[j] %= 10;
					test_br += (sum[j] * pow(10, j));
				}
			}
			
			do
			{
				test_br -= 1000000007;
			} while (test_br > 100000007);
			test_br += 1000000007;
			for (int j = 0;j < 10;j++)
			{
				sum[j] = test_br % 10;
				test_br /= 10;
			}
		}
		test_br = 0;
		for (int j = 0;j < 10;j++)
		{
			test_br += (sum[j] * pow(10, j));
		}
		return test_br;
	}
	else
	{
		unsigned long long int test_br = 0;
		int sum[11] = { 0,0,0,0,0,0,0,0,0,0,0 };
		for (int i = 0;i < N;i++)
		{
			for (int j = i;j < N;j++)
			{
				int B[(j - i) + 1];
				for (int z = 0;z <= (j - i);z++)
					B[z] = A[z];
				test_br = funkcija(B, (j - i) + 1, k - 1);
				for (int y = 0;j < 10;j++)
				{
					sum[y] += test_br % 10;
					test_br /= 10;
				}
				for (int x = 0;x < 10;x++)
				{
					if (sum[x] / 10 > 0)
					{
						sum[x + 1] += sum[x] / 10;
						sum[x] %= 10;
						test_br += (sum[x] * pow(10, x));
					}
				}
				do
				{
					test_br -= 1000000007;
				} while (test_br > 100000007);
				test_br += 1000000007;
				for (int j = 0;j < 10;j++)
				{
					sum[j] = test_br % 10;
					test_br /= 10;
				}
			}
		}
		for(int x=0;x<10;x++)
			test_br += (sum[x] * pow(10, x));
		return test_br;
	}
}

int main()
{
	int N, k;
	int A[200000];
	int pobednik;
	cin >> N;
	cin >> k;
	for (int i = 0;i < N;i++)
	{
		cin >> A[i];
	}
	pobednik = funkcija(A, N, k);
	cout << pobednik << endl;
	return 0;
}