#include <bits/stdc++.h>
inline long long read() {
  long long x = 0, f = 1;
  char 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;
}
const long long mod = 1e9 + 7;
long long n, m;
inline long long ksm(long long a, long long b, long long p) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % p;
    a = a * a % p;
    b >>= 1;
  }
  return ret;
}
int main(void) {
  n = read(), m = read();
  printf("%lld\n", ksm(2, m, mod) % mod * ksm(n + 1, m - 1, mod) % mod *
                       (n - m + 1) % mod);
  return 0;
}
