using System;

namespace takmicenje_zad_resi
{
    class Program
    {
        static int c()
        {
            return 0;
        }
        static int b(int[] a, int k)
        {
            if (k == 0) return b0(a);
            return 0;
        }
        static int b0(int[] a)
        {
            int r = 0;
            for (int i = 0; i < a.Length; i++) r += a[i];
            while (r > 100000007) r -= 100000007;
            return r;
        }
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = int.Parse(s[0]);
            int k = int.Parse(s[1]);
            s = Console.ReadLine().Split();
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = int.Parse(s[i]);
            Console.WriteLine(b(a,k));
        }
    }
}