#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
inline int read(int &n) {
  char c = getchar();
  int x = 0, f = 1;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + (c - '0');
    c = getchar();
  }
  return n = x * f;
}
inline void read(int &a, int &b) { read(a), read(b); }
inline void read(int &a, int &b, int &c) { read(a, b), read(c); };
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
const int N = 1e5 + 7;
int T, n, m, k;
int main(int argc, char const *argv[]) {
  long long n, m, k;
  scanf("%lld%lld", &n, &m);
  if (n == 0)
    printf("0\n");
  else
    printf("%lld\n",
           (powmod(2, m) * ((2 * n - 1) % mod) % mod + 1 + mod) % mod);
  return 0;
}
