#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int read() {
  int x = 0, f = 1, ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
  return x * f;
}
int n, m;
int pw(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = 1ll * res * a % mod;
    a = 1ll * a * a % mod, b >>= 1;
  }
  return res;
}
signed main() {
  n = read(), m = read();
  printf("%lld\n", 1ll * (n + 1 - m) * pw(2, m) % mod * pw(n + 1, m) % mod *
                       pw(n + 1, mod - 2) % mod);
  return 0;
}
