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