#include <bits/stdc++.h>
using namespace std;
long long qm(long long x, long long k) {
  long long res = 1;
  while (k) {
    if (k & 1) {
      res *= x;
      res %= 1000000007;
    }
    x *= x;
    x %= 1000000007;
    k >>= 1;
  }
  return res;
}
int main() {
  long long x, n;
  scanf("%lld%lld", &x, &n);
  if (x == 0) {
    printf("0\n");
    return 0;
  }
  x %= 1000000007;
  long long x1 = x * qm(2, n + 1) % 1000000007;
  long long X = qm(2, n);
  long long res = (x1 * X) % 1000000007 - (X * (X - 1) % 1000000007);
  res = (res % 1000000007 + 1000000007) % 1000000007;
  long long tmp = qm(X, 1000000007 - 2);
  res = (res * tmp) % 1000000007;
  printf("%lld\n", res);
  return 0;
}
