#include <bits/stdc++.h>
using namespace std;
long long power(long long n, long long r) {
  long long result = 1;
  while (r > 0) {
    if (r % 2 != 0)
      result = (result % 1000000007 * n % 1000000007) % 1000000007;
    n = (n % 1000000007 * n % 1000000007) % 1000000007;
    r = r / 2;
  }
  return result;
}
signed main() {
  long long n, k;
  cin >> n >> k;
  if (n == 0)
    cout << 0 << endl;
  else if (k == 0) {
    cout << (2 * n % 1000000007) % 1000000007 << endl;
  } else {
    long long u = power(2, k + 1);
    long long y = power(2, k);
    long long ans =
        (n % 1000000007 * u % 1000000007 - y + 1 + 1000000007) % 1000000007;
    cout << ans << endl;
  }
}
