#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
inline long long quick(long long mul, long long b) {
  long long c = 1;
  while (b) {
    if (b & 1) {
      c = c * mul % mod;
    }
    mul = mul * mul % mod;
    b /= 2;
  }
  return c;
}
int main() {
  long long n, m;
  cin >> n >> m;
  cout << (quick(2 * n + 2, m) * (n - m + 1) % mod) * quick(n + 1, mod - 2) %
              mod;
  return 0;
}
