#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int M = 300005;
long long read() {
  long long ans = 0, op = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') op = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    ans *= 10;
    ans += ch - '0';
    ch = getchar();
  }
  return ans * op;
}
long long n, m;
long long qpow(long long a, long long b) {
  long long q = 1;
  while (b) {
    if (b & 1) q *= a, q %= mod;
    a *= a, a %= mod;
    b >>= 1;
  }
  return q;
}
int main() {
  n = read(), m = read();
  printf("%I64d\n", qpow(2, m) * qpow(n + 1, m - 1) % mod * (n + 1 - m) % mod);
  return 0;
}
