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