#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int P = 1e9 + 7;
inline int read() {
  char a = getchar();
  int x = 0, f = 1;
  for (; a > '9' || a < '0'; a = getchar())
    if (a == '-') f = -1;
  for (; a >= '0' && a <= '9'; a = getchar()) x = x * 10 + a - '0';
  return x * f;
}
inline int qpow(int x, int k) {
  int res = 1;
  while (k) {
    if (k & 1) res = 1LL * res * x % P;
    x = 1LL * x * x % P;
    k >>= 1;
  }
  return res;
}
int main() {
  int n = read(), m = read();
  int ans =
      1LL * qpow(2 * (n + 1), m) * (n + 1 - m) % P * qpow(n + 1, P - 2) % P;
  printf("%d\n", ans);
  return 0;
}
