#include <bits/stdc++.h>
using namespace std;
inline void Read(int &x) {
  int f = 1;
  char c = getchar();
  x = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 3) + (x << 1) + c - '0';
    c = getchar();
  }
  x *= f;
}
const int p = 1000000007;
int n, m;
inline int Pow(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) res = 1ll * a * res % p;
    a = 1ll * a * a % p, b >>= 1;
  }
  return res;
}
int main() {
  Read(n), Read(m);
  cout << 1ll * Pow(2, m) * Pow(n + 1, m - 1) % p * (n - m + 1) % p << endl;
  return 0;
}
