#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long n, k;
long long quickpow(long long base, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * base % mod;
    n >>= 1;
    base = base * base % mod;
  }
  return res;
}
int main() {
  cin >> n >> k;
  if (n == 0) {
    cout << "0" << endl;
    return 0;
  }
  n = n % mod;
  long long ans =
      ((quickpow(2, k + 1) * n % mod - (quickpow(2, k) - 1 + mod) % mod) % mod +
       mod) %
      mod;
  ans = (ans + mod) % mod;
  cout << ans << endl;
  return 0;
}
