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