#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long k, long long p) {
  long long ret = 1;
  while (k) {
    if (k % 2) ret = (ret * a) % p;
    k /= 2;
    a = (a * a) % p;
  }
  return ret % p;
}
int main() {
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << 0 << endl;
    return 0;
  }
  x %= 1000000007;
  long long ans =
      (((2 * x) % 1000000007 - 1) * modpow(2, k, 1000000007)) % 1000000007;
  cout << (ans + 1 + 1000000007) % 1000000007 << endl;
  return 0;
}
