#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long n, m;
inline long long pw(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  printf("%lld\n", pw(2, m) * pw(n + 1, m - 1) % mod * (n - m + 1) % mod);
  return 0;
}
