const P = 1000000007;
var n, k, i, rem, tmp : longint;
a : array [0..200005] of longint;
ans, pw : int64;
procedure qsort(l,r:longint);
var i,j,x,y:longint;
begin
i:=l; j:=r; x:=a[(l+r) div 2];
repeat
while (a[i]<x) do inc(i);
while (a[j]>x) do dec(j);
if (i<=j) then
begin
y:=a[i];
a[i]:=a[j];
a[j]:=y;
inc(i);
dec(j);
end;
until i>j;
if (i<r) then qsort(i,r);
if (j>l) then qsort(j,l);
end;
begin
read(n, k);
for i := 1 to n do
read(a[i]);
a[n + 1] := P * 2
qsort(1, n);
while (a[1] < P) and (k > 0) do
begin
tmp := a[1] * 2;
for i := 2 to n do
begin
if a[i-1] > a[i] then
begin
writeln(-1);
halt;
end;
end;
for i := 1 to n do
begin
if (k = 0) or (a[i] > tmp) then
break;
a[i] := a[i] * 2;
dec(k);
end;
qsort(1, n);
end;
pw := 1;
rem := k mod n;
k := k div n;
while k > 30 do
begin
pw := (pw << 30) mod P;
k := k - 30;
end;
for i := 1 to k do
pw := pw * 2 mod P;
for i := 1 to rem do
ans := (ans + a[i] * pw * 2) mod P;
for i := rem + 1 to n do
ans := (ans + a[i] * pw) mod P;
writeln(ans);
end.