#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1000005;
const int MOD = 1e9 + 7;
int n, m;
long long Read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c > '9' || c < '0') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x * 10) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
template <typename T>
void Put1(T x) {
  if (x > 9) Put1(x / 10);
  putchar(x % 10 ^ 48);
}
template <typename T>
void Put(T x, char c = -1) {
  if (x < 0) putchar('-'), x = -x;
  Put1(x);
  if (c >= 0) putchar(c);
}
template <typename T>
T Max(T x, T y) {
  return x > y ? x : y;
}
template <typename T>
T Min(T x, T y) {
  return x < y ? x : y;
}
template <typename T>
T Abs(T x) {
  return x < 0 ? -x : x;
}
int qpow(int x, int y) {
  int ret = 1;
  while (y) {
    if (y & 1) ret = 1ll * ret * x % MOD;
    x = 1ll * x * x % MOD;
    y >>= 1;
  }
  return ret;
}
int main() {
  n = Read();
  m = Read();
  Put(((1 - 1ll * m * qpow(n + 1, MOD - 2)) % MOD * qpow(2 * n + 2, m) % MOD +
       MOD) %
      MOD);
  return 0;
}
