#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b % 2 != 0) ans *= a;
    ans %= mod;
    a = (a * a) % mod;
    b /= 2;
  }
  ans %= mod;
  return ans;
}
int main() {
  long long x, k;
  long long ans;
  cin >> x >> k;
  if (k == 0) {
    ans = (x * 2) % mod;
  } else {
    if (x != 0) {
      x %= mod;
      ans = (x * qpow(2, k + 1) % mod - (qpow(2, k)) % mod + 1 + mod) % mod;
    } else
      ans = 0;
  }
  cout << ans << endl;
}
