#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b) {
  if (a == 0 && b == 0) return 0;
  long long pro = 1;
  while (b) {
    if (b & 1) pro = (pro * a) % 1000000007;
    a = (a * a) % 1000000007;
    b = b >> 1;
  }
  return pro;
}
int main() {
  long long x, k, pro = 1;
  cin >> x >> k;
  if (x == 0)
    pro = 0;
  else {
    pro = pro * (power(2, k));
    pro = (pro * (((2 * x) % 1000000007 - 1 + 1000000007) % 1000000007)) %
          1000000007;
    pro = (pro + 1) % 1000000007;
  }
  cout << pro << "\n";
  return 0;
}
