#include <iostream>
#include <bits/stdc++.h>

using namespace std;
int main()
{
    int N, k;
    vector <int> A;
    cin >> N >> k;
    long long zbir = 0;
    int tek;
    for(int i=0; i<N; i++)
    {
        cin >> tek;
        A.push_back(tek);
        zbir+=tek;
    }
    if(k==0)
        cout << zbir;
    else if(k==1)
        cout << (zbir*(long long)(pow(2,N-1)))%1000000007;
    else
        cout << (zbir*(long long)(pow(2,N-1)*(k-1)))%1000000007;
    return 0;
}