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