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

namespace TGakProg24
{
    class Program
    {
        static int F(int[] a)
        {
            int s = 0;
            for (int i = 0; i < a.Length; i++)
                s += a[i];
            return s;
        }
        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[] c = new int[n];
            for (int i = 0; i < n; i++)
                c[i] = int.Parse(s[i]);
            if (k == 0)
                Console.WriteLine(F(c));
            else
            {
                int z = 0;
                for (int i = 0; i < n; i++)
                    for (int j = i; j < n; j++)
                    {
                        int[] t = new int[j + 1];
                        for (int p = 0; p < j; p++)
                        {
                            t[p] = c[p];
                        }
                        z += F(t);
                    }
                z *= k;
                z %= (int)(Math.Pow(10, 9) + 7);
                Console.WriteLine(z);
            }
        }
    }
}