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