#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
long long Pow(long long x, long long y) {
  if (!y) return 1;
  if (y == 1) return x;
  long long t = Pow(x, y >> 1), re = t * t % mod;
  if (y & 1) re = re * x % mod;
  return re;
}
int main() {
  long long x = read(), k = read();
  if (!x) return puts("0"), 0;
  long long st, ed, t;
  ed = (x % mod) * Pow(2, k + 1) % mod;
  st = (ed - Pow(2, k + 1) + 2 + mod) % mod;
  t = Pow(2, k);
  long long inv = Pow(2, mod - 2);
  printf("%lld\n", (st + ed) % mod * t % mod * Pow(inv, k + 1) % mod);
}
