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