#include <bits/stdc++.h>
using namespace std;
unsigned long long mod = 1000000007LL;
unsigned long long mpow(unsigned long long x, unsigned long long e) {
  if (e == 0) return 1;
  if (e % 2 == 0) {
    unsigned long long k = (mpow(x, e / 2) % mod);
    return (k * k) % mod;
  } else
    return (x * mpow(x, e - 1)) % mod;
}
int main() {
  unsigned long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  unsigned long long r = ((mpow(2, k) % mod) * ((2 * x - 1) % mod) + 1) % mod;
  cout << r << endl;
}
