#include <bits/stdc++.h>
using namespace std;
long long n, m;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % 1000000007;
    a = 1ll * a * a % 1000000007;
    b >>= 1;
  }
  return ans % 1000000007;
}
signed main() {
  cin >> n >> m;
  long long c = n - m + 1;
  c *= 2;
  n++;
  n *= 2;
  m--;
  long long tot = qpow(n, m);
  long long amo = (c * tot) % 1000000007;
  amo %= 1000000007;
  cout << amo;
  return 0;
}
