using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.SymbolStore;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Net.WebSockets;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;


namespace ConsoleApplication2
{

    class Program
    {
        static List<int> konv(string o)
        {
           
            var v=o.ToCharArray().ToList().ConvertAll<int>(Convert.ToInt32);
            for (int k = 0; k < v.Count; k++)
                v[k] -= 48;
            return v;
        }
        static void Main(string[] args)
        {
           
            var s = Console.ReadLine().Split();
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);
            var a = Console.ReadLine().Split().Select(int.Parse).ToList();
            List<List<int>> b = new List<List<int>>();
            b.Add(a);
            int y = 0;
            long zb = 0;
            List<string> o = new List<string>();
            if (k == 0)
            {
                for (int i = 0; i < n; i++)
                {
                    zb = zb + a[i];
                    zb = zb % 1000000007;
                }

            }
            else
            {

                for (long m = k - 1; m >= 0; m--)
                {
                    for (int r = 0; r < b.Count; r++)
                    {
                        for (int i = 0; i < b[r].Count; i++)
                        {

                            for (int j = i; j < b[r].Count; j++)
                            {
                                o.Add("");
                                for (int l = i; l < j + 1; l++)
                                {
                                    o[y] += Convert.ToString(b[r][l]);
                                }
                                y++;
                            }
                        }

                    }
                    y = 0;
                    b.Clear();
                    for (int p = 0; p < o.Count; p++)
                        b.Add(konv(o[p]));
                    o.Clear();
                    if (m == 0)
                    {
                        for (int e = 0; e < b.Count; e++)
                        {
                            for (int q = 0; q < b[e].Count; q++)
                            {
                                zb += b[e][q];
                                zb = zb % 1000000007;
                            }
                        }
                    }

                }
            }
            Console.WriteLine(zb % 1000000007);

        }

    }
}