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