#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &a, const T &b) {
  return b < a ? a = b, 1 : 0;
}
template <typename T>
inline bool chkmax(T &a, const T &b) {
  return a < b ? a = b, 1 : 0;
}
const int oo = 0x3f3f3f3f;
const long long P = 1e9 + 7;
long long qpow(long long a, long long b) {
  long long ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = (ans * a) % P;
    a = (a * a) % P;
  }
  return ans;
}
int main() {
  long long n, k;
  while (cin >> n >> k) {
    if (n == 0) {
      cout << 0 << endl;
      continue;
    }
    long long ft = (n % P * qpow(2ll, k + 1)) % P;
    long long la = (ft - (qpow(2ll, k + 1) - 2ll + P) % P + P) % P;
    cout << ((ft + la) % P * qpow(2ll, P - 2)) % P << endl;
  }
  return 0;
}
