#include <bits/stdc++.h>
using namespace std;
const int MOD = (1e9) + 7;
int n, m;
int fpow(int a, int b) {
  if (a == 0) return 0;
  if (b == 0) return 1;
  int p = fpow(a, b >> 1);
  p = p * 1ll * p % MOD;
  if (b & 1) p = p * 1ll * a % MOD;
  return p;
}
int div_mod(int a, int b) { return a * 1ll * fpow(b, MOD - 2) % MOD; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  scanf("%d %d", &n, &m);
  printf("%d\n",
         div_mod(fpow(2 * (n + 1), m) * 1ll * (n - m + 1) % MOD, n + 1));
  return 0;
}
