#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long n, m;
long long ksm(long long x, long long y) {
  long long ans = 1;
  for (; y; y >>= 1, x = x * x % M)
    if (y & 1) (ans *= x) %= M;
  return ans;
}
signed main() {
  scanf("%lld%lld", &n, &m);
  printf("%lld\n",
         (n + 1 - m) * ksm(n + 1, M - 2) % M * ksm(2 * (n + 1), m) % M);
}
