#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int mpow(int x, int n) {
  int res = 1;
  while (n) {
    if (n & 1) res = 1LL * res * x % MOD;
    x = 1LL * x * x % MOD;
    n >>= 1;
  }
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int ans = 1LL * mpow(2 * (n + 1), m) * (n + 1 - m) % MOD *
            mpow(n + 1, MOD - 2) % MOD;
  printf("%d\n", ans);
}
