#include <bits/stdc++.h>
inline int read() {
  register int x = 0;
  register int y = 1;
  register char c = getchar();
  while (c < '0' || c > '9') y &= (c != '-'), c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + (c ^ 48), c = getchar();
  return y ? x : -x;
}
inline long long power(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % 1000000007;
    b >>= 1;
    a = a * a % 1000000007;
  }
  return ans;
}
int main() {
  int n = read(), m = read();
  printf("%lld\n", power(2, m) * power(n + 1, m - 1) % 1000000007 *
                       (n + 1 - m) % 1000000007);
  return 0;
}
