#include <bits/stdc++.h>
const int mod = 1e9 + 7;
int n, m;
inline long long ksm(register int y, register int p) {
  long long x = y, now = 1;
  while (p) {
    if (p & 1) now = now * x % mod;
    x = x * x % mod, p >>= 1;
  }
  return now;
}
int main() {
  scanf("%d%d", &n, &m);
  printf("%lld", ksm(2, m) % mod * ksm(n + 1, m - 1) % mod * (n + 1 - m) % mod);
  return 0;
}
