#include<iostream>
#include<algorithm>
using namespace std;
#define int long long
const int N = 2e5 + 5, p = 1e9 + 7;
pair<int, int> nums[N], heap[N];
int ans, arr[N], Logarr[N], dLog[N];
bool smaller(pair<int, int> a, pair<int, int> b)
{
double x = log2(nums[a.first].first) + nums[a.first].second;
double y = log2(nums[b.first].first) + nums[b.first].second;
if (x < y) return true; else return false;
}
void heapInsert(int idx)
{
while (idx != 0 && smaller(heap[idx], heap[idx / 2]))
{
pair<int, int> tmp = heap[idx]; heap[idx] = heap[idx / 2];
heap[idx / 2] = tmp; idx = idx / 2;
}
}
void heapify(int idx, int size)
{
int l = 2 * idx;
while (l <= size)
{
int mini = l + 1 <= size && smaller
(heap[l + 1], heap[l]) ? l + 1 : l;
if (smaller(heap[idx], heap[mini])) break;
pair<int, int> tmp = heap[mini]; heap[mini] = heap[idx];
heap[idx] = tmp; idx = mini; l = 2 * idx;
}
}
int power(int a, int b)
{
int tmp = 2, ans = 1;
while (b > 0)
{
if (b % 2) ans = (ans * tmp) % p;
tmp = (tmp * tmp) % p; b /= 2;
}
return (a * ans) % p;
}
//С\xb8\xf9\xb6\xd1ά\xbb\xa4\xd7\xeeСֵ
//signed main()
//{
// int n, k; cin >> n >> k;
// for (int i = 1; i <= n; i++)
// {
// cin >> nums[i].first;
// nums[i].second = 0;
// heap[i] = { i, nums[i].first };
// heapInsert(i);
// }
//
// for (int i = 0; i < k; i++)
// {
// //ʱ\xbc临\xd4Ӷ\xc8O(k*logn)\xa3\xack\xb1Ƚϴ\xf3ʱ\xce\xa8\xd4\xdaʱ\xcf\xde\xc4ڵõ\xbd\xbd\xe1\xb9\xfb
// heap[1].second = (heap[1].second * 2) % p;
// nums[heap[1].first].second++; heapify(1, n);
// }
//
// for (int i = 1; i <= n; i++)
// {
// ans += heap[i].second; ans %= p;
// }
// cout << ans;
//
// return 0;
//}
signed main()
{
int n, k; cin >> n >> k;
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
}
sort(arr + 1, arr + n + 1);
for (int i = 1; i <= n; i++)
{
Logarr[i] = log2(arr[i]);
}
//dLog[i]\xb1\xedʾ\xb0\xd1ǰi\xb8\xf6\xca\xfd\xb5\xc4log2ֵ\xb6\xbc\xb1\xe4\xb3\xc9
//log2(arr[i])\xcb\xf9\xd0\xe8Ҫ\xb5IJ\xd9\xd7\xf7\xb4\xce\xca\xfd
for (int i = 1; i <= n; i++)
{
dLog[i] = dLog[i - 1] + (i - 1) *
(Logarr[i] - Logarr[i - 1]);
}
int stop = n, times = 0;
for (int i = 1; i <= n; i++)
{
if (k < dLog[i])
{
stop = i - 1; break;
}
}
times = k - dLog[stop];
//\xcfȰ\xd1ǰstop - 1\xb8\xf6\xca\xfd\xb6\xbc\xb2\xbb\xb6ϳ˶\xf8ֱ\xd6\xc1\xcb\xfc\xc3ǵ\xc4log2ֵ\xb6\xbc\xb5\xc8\xd3\xdalog2(arr[stop])
//\xd4ٰ\xd1ʣ\xcfµIJ\xd9\xd7\xf7\xb4\xce\xca\xfd(times)***\xb6\xd3ǰ\xd3\xc5\xcf\xc8ƽ\xbe\xf9***\xb7ָ\xf8ǰstop\xb8\xf6\xca\xfd
//\xd3\xc9\xd3ڿ\xc9\xd2\xd4ʹ\xd3ÿ\xec\xcb\xd9\xc3ݣ\xac\xcb\xf9\xd2Ի\xe1\xb1\xc8С\xb8\xf9\xb6ѵ\xc4ʵ\xcfָ\xfc\xbf\xec
for (int i = 1; i < stop; i++)
{
arr[i] = power(arr[i], Logarr[stop] - Logarr[i]);
}
int t = times / stop, s = times - t * stop;
for (int i = 1; i <= stop; i++)
{
if (i <= s) arr[i] = power(arr[i], t + 1);
else arr[i] = power(arr[i], t);
}
for (int i = 1; i <= n; i++)
{
ans += arr[i]; ans %= p;
}
cout << ans;
return 0;
}