#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long power(long long x, long long y) {
  long long ans = 1;
  x %= mod;
  while (y > 0) {
    if (y % 2 == 1) ans = ans * x % mod;
    y /= 2;
    x = x * x % mod;
  }
  return ans % mod;
}
int main() {
  long long x, k;
  cin >> x >> k;
  if (x % 1000000007 != 0) x %= mod;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  long long coef = power(2, k) % mod;
  long long coef2 = (coef * 2) % mod;
  long long ans = (coef2 * x) % mod;
  ans -= (coef - 1);
  ans %= mod;
  if (ans < 0) ans += mod;
  cout << ans % mod << endl;
}
