#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long x, k;
long long qow(long long a, long long b) {
  long long ans = 1;
  a = a % mod;
  while (b) {
    if (b % 2 == 1) {
      ans = (ans * a) % mod;
    }
    a = (a * a) % mod;
    b /= 2;
  }
  return ans;
}
int main() {
  while (~scanf("%lld %lld", &x, &k)) {
    if (x == 0) {
      printf("0\n");
      continue;
    }
    x = x % mod;
    cout << (((2 * x - 1) * qow(2, k) + mod) % mod + 1 + mod) % mod << endl;
  }
  return 0;
}
