#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char c;
  int res = 0, f = 1;
  while (c = getchar(), !isdigit(c))
    if (c == '-') f *= -1;
  while (isdigit(c)) res = res * 10 + c - '0', c = getchar();
  return res * f;
}
const long long mod = 1e9 + 7;
long long n, m;
inline long long lpow(long long a, long long b) {
  long long x = a, res = 1;
  while (b) {
    if (b & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    b >>= 1;
  }
  return res % mod;
}
int main() {
  n = read();
  m = read();
  cout << lpow(2, m) % mod * lpow(n + 1, m - 1) % mod * (n - m + 1) % mod
       << endl;
  return 0;
}
