#include <bits/stdc++.h>
using namespace std;
void hk() {}
long long solve(long long x, int k) {
  long long t = 1;
  for (; k; k >>= 1, x = x * x % (1000000007))
    if (k & 1) t = t * x % (1000000007);
  return t;
}
int main() {
  {
    int n, m;
    cin >> n >> m;
    long long res = 1ll * solve(2, m) * solve(n + 1, m - 1) % (1000000007) *
                    (n + 1 - m) % (1000000007);
    cout << res << endl;
  }
  return 0;
}
