#include <bits/stdc++.h>
using namespace std;
long long int exp(long long int p, long long int m) {
  long long int res = 1, x = 2;
  while (p > 0) {
    if (p & 1) res = ((res % m) * (x % m)) % m;
    p >>= 1;
    x = ((x % m) * (x % m)) % m;
  }
  res %= m;
  return res;
}
int main() {
  long long int x, k, m = 1000000007;
  cin >> x >> k;
  if (x == 0) {
    cout << 0;
    exit(0);
  }
  long long int tr = exp(k, m), res;
  res = (2 * tr * (x % m)) % m;
  res -= (tr - 1) % m;
  res %= m;
  if (res < 0) res += m;
  cout << res;
}
