#include <bits/stdc++.h>
using namespace std;
template <typename T>
T read1() {
  T t = 0;
  char k;
  bool vis = 0;
  do (k = getchar()) == '-' && (vis = 1);
  while ('0' > k || k > '9');
  while ('0' <= k && k <= '9')
    t = (t << 3) + (t << 1) + (k ^ '0'), k = getchar();
  return vis ? -t : t;
}
int qkpow(long long x, int y) {
  int t = 1;
  while (y) {
    if (y & 1) t = t * x % 1000000007;
    x = x * x % 1000000007;
    y >>= 1;
  }
  return t;
}
int main() {
  int n = read1<long long>(), m = read1<long long>();
  printf("%lld", (n - m + 1ll) * qkpow(2, m) % 1000000007 *
                     qkpow(n + 1, m - 1) % 1000000007);
  return 0;
}
