#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long f = 1, ans = 0;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    ans = ans * 10 + c - '0';
    c = getchar();
  }
  return f * ans;
}
long long N, M;
long long ksm(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans *= a, ans %= 1000000007;
    a *= a, a %= 1000000007;
    b >>= 1;
  }
  return ans;
}
signed main() {
  N = read(), M = read();
  printf("%lld\n", ksm(2 * (N + 1), M) * (N + 1 - M) % 1000000007 *
                       ksm(N + 1, 1000000007 - 2) % 1000000007);
  return 0;
}
