#include <bits/stdc++.h>
using namespace std;
const int p = 1e9 + 7;
inline int qpow(int A, int B) {
  int res = 1;
  while (B) {
    if (B & 1) res = (long long)res * A % p;
    A = (long long)A * A % p, B >>= 1;
  }
  return res;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  printf("%I64d\n", (long long)qpow((n + 1) << 1, m) * (n + 1 - m) % p *
                        qpow(n + 1, p - 2) % p);
  return 0;
}
