#include <bits/stdc++.h>
using namespace std;
int power(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() {
  long long x, k;
  cin >> x >> k;
  if (x == 0)
    cout << 0;
  else {
    long long temp = power(2, k, 1000000007);
    long long ans = (temp % 1000000007 *
                     (2 * (x % 1000000007) - 1 + 1000000007) % 1000000007) %
                    1000000007;
    ans = (ans + 1) % 1000000007;
    cout << ans;
  }
}
