#include <bits/stdc++.h>
using namespace std;
int n, m, sum;
int pow(int x, int k) {
  for (sum = 1; k; k >>= 1, x = 1LL * x * x % 1000000007)
    if (k & 1) sum = 1LL * sum * x % 1000000007;
  return sum;
}
int main() {
  scanf("%d%d", &n, &m);
  printf("%d\n", 1LL * pow(n + 1, m - 1) * (n - m + 1) % 1000000007 *
                     pow(2, m) % 1000000007);
}
