#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long power(long long x, long long y) {
  long long ret = 1;
  while (y) {
    if (y % 2) {
      ret = (ret * x) % mod;
    }
    x = (x * x) % mod;
    y /= 2;
  }
  return ret % mod;
}
int main() {
  long long n, k;
  cin >> n >> k;
  long long sum;
  if (n == 0) {
    cout << 0 << endl;
  } else if (n == 1) {
    cout << power(2, k) + 1 << endl;
  } else if (k == 0) {
    cout << (2 * n) % mod << endl;
  } else {
    long long a = (n * 2 - 1) % mod;
    long long m = power(2, k);
    a = (a * m) % mod;
    cout << (a + 1) % mod << endl;
  }
}
