#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
int n, m;
template <typename Tp>
void read(Tp &x) {
  x = 0;
  int f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  x *= f;
}
int qpow(int a, int b) {
  int ans = 1;
  for (; b; b >>= 1) {
    if (b & 1) ans = (long long)ans * a % mod;
    a = (long long)a * a % mod;
  }
  return ans;
}
int main() {
  read(n), read(m);
  printf("%lld\n", (long long)(n - m + 1) * qpow(2, m) % mod * qpow(n + 1, m) %
                       mod * qpow(n + 1, mod - 2) % mod);
  return 0;
}
