using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static int nadjicifre(int n)
        {
            int suma = 0;

            while (n != 0)
            {
                suma = suma + n % 10;
                n = n / 10;
            }
            return suma;
        }
  static void nadjizbir(int n, ref int zbir) 
{

    int s = (int)Math.Log10(n); 
    int d = (int)(Math.Pow(10, s) + 0.5); 
    int k = d;
  
    while (n > 0) 
    { 
        while (d > 0)  
        {    
            zbir = (zbir + nadjicifre(n/d)%1000000007);
            d = d / 10; 
        }    
        n = n % k; 
        k = k / 10; 
        d = k; 
    }
}


static void Main(string[] args)
{
    int zbir = 0;
    string[] str = Console.ReadLine().Split();
    int n = int.Parse(str[0]);
    int k = int.Parse(str[1]);
    int a = 0;
    int i = 0;
   
    string q = Console.ReadLine();
    q = q.Replace(" ", string.Empty);
    a = int.Parse(q);
    if (k == 0)
    {
        Console.WriteLine(nadjicifre(a));
    }
    while (i < k)
    {
        nadjizbir(a, ref zbir);
        //Console.WriteLine(zbir);
        i++;
    }
    if (k != 0)
    {
        zbir = zbir % 1000000007;
        Console.WriteLine(zbir);
    }
   
    
    //Console.ReadLine();
} 
} 
        }