using System;
using System.Linq;

namespace Zadatak_4
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(input[0]);
            int k = Convert.ToInt32(input[1]);
            int[] A = new int[n];
            string[] input_ = Console.ReadLine().Split(' ');
            for (int i = 0; i < n; i++)
            {
                A[i] = Convert.ToInt32(input_[i]);
            }

            if (k == 0)
                Console.WriteLine(A.Sum() % (Math.Pow(10, 9) + 7));
            else
            {
                int sum = 0;
                for (int r = 0; r <= A.Length; r++)
                {
                    for (int i = 0; i < A.Length; i++)
                    {
                        for (int j = 0 + r; j <= i; j++)
                        {
                            sum += A[j];
                        }
                    }
                }

                sum *= k;

                Console.WriteLine(sum % (Math.Pow(10, 9) + 7));
            }
        }
    }
}