#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int x;
long long int k;
long long int res;
long long int curr;
long long int exponentiation(long long int base, long long int power) {
  long long int ans = 1;
  while (power > 0) {
    if (power % 2) ans = (ans * base) % mod;
    base = (base * base) % mod;
    power /= 2;
  }
  return ans % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> x >> k;
  if (x == 0) {
    res = 0;
  } else if (k == 0) {
    res = (2 * x) % mod;
  } else {
    curr = (2 * x - 1 - x + mod) % mod;
    res =
        (x + ((((curr + x) % mod) * exponentiation(2, k)) % mod - curr) + mod) %
        mod;
  }
  cout << res << endl;
  return 0;
}
