#include <bits/stdc++.h>
using namespace std;
long long power(long long x, long long y, long long p) {
  int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = ((res % p) * (x % p)) % p;
    y = y / 2;
    x = ((x % p) * (x % p)) % p;
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  long long x, k;
  cin >> x >> k;
  if (x == 0) {
    cout << "0";
    return 0;
  }
  long long p1 = power(2, k + 1, 1000000007);
  p1 = (p1 * (x % 1000000007)) % 1000000007;
  long long p2 = power(2, k, 1000000007);
  p2 = (p2 - 1 + 1000000007) % 1000000007;
  long long ans = (p1 - p2 + 1000000007) % 1000000007;
  cout << ans;
}
