#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int lim = 1e8;
const int mod = 1e9 + 7;
long long ksm(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = (ret * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return ret % mod;
}
int main() {
  long long x, k;
  scanf("%lld%lld", &x, &k);
  if (x == 0) {
    printf("0\n");
    return 0;
  }
  printf("%lld\n", (x % mod * ksm(2, k + 1) % mod - ksm(2, k) + 1 + mod) % mod);
  return 0;
}
