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