#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long x, k, a = 2, res = 1;
  cin >> x >> k;
  if (x == 0) {
    cout << 0;
    return 0;
  }
  if (k == 0) {
    cout << (x * 2) % 1000000007;
    return 0;
  }
  while (k) {
    if (k % 2 == 1) res = ((res % 1000000007) * (a % 1000000007)) % 1000000007;
    a = ((a % 1000000007) * (a % 1000000007)) % 1000000007;
    k = k / 2;
  }
  cout << (((res % 1000000007) * 2 * (x % 1000000007)) % 1000000007 -
           res % 1000000007 + 1 + 1000000007) %
              1000000007
       << endl;
  return 0;
}
