#include <bits/stdc++.h>
template <class T>
inline T read(const T sample) {
  T x = 0;
  int f = 1;
  char s;
  while ((s = getchar()) > '9' || s < '0')
    if (s == '-') f = -1;
  while (s >= '0' && s <= '9')
    x = (x << 1) + (x << 3) + (s ^ 48), s = getchar();
  return x * f;
}
template <class T>
inline void write(const T x) {
  if (x < 0) return (void)(putchar('-'), write(-x));
  if (x > 9) write(x / 10);
  putchar(x % 10 ^ 48);
}
template <class T>
inline T Max(const T x, const T y) {
  if (x > y) return x;
  return y;
}
template <class T>
inline T Min(const T x, const T y) {
  if (x < y) return x;
  return y;
}
template <class T>
inline T fab(const T x) {
  return x > 0 ? x : -x;
}
template <class T>
inline T gcd(const T x, const T y) {
  return y ? gcd(y, x % y) : x;
}
template <class T>
inline T lcm(const T x, const T y) {
  return x / gcd(x, y) * y;
}
const int mod = 1e9 + 7;
int qkpow(int x, int y) {
  int r = 1;
  while (y) {
    if (y & 1) r = 1ll * r * x % mod;
    x = 1ll * x * x % mod;
    y >>= 1;
  }
  return r;
}
int main() {
  int n = read(9), m = read(9);
  write(1ll * qkpow(2 * (n + 1), m) * (n + 1 - m) % mod *
        qkpow(n + 1, mod - 2) % mod),
      putchar('\n');
  return 0;
}
