#include <bits/stdc++.h>
using namespace std;
void file(string s) {
  freopen((s + ".in").c_str(), "r", stdin);
  freopen((s + ".out").c_str(), "w", stdout);
}
template <typename Tp>
void read(Tp &x) {
  int fh = 1;
  char c = getchar();
  x = 0;
  while (c > '9' || c < '0') {
    if (c == '-') {
      fh = -1;
    }
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = (x << 1) + (x << 3) + (c & 15);
    c = getchar();
  }
  x *= fh;
}
int ksm(int b, int p, int Mod = 1000000007) {
  int ret = 1;
  while (p) {
    if (p & 1) ret = 1ll * ret * b % Mod;
    b = 1ll * b * b % Mod;
    p >>= 1;
  }
  return ret;
}
int n, m;
signed main() {
  read(n);
  read(m);
  printf("%lld\n", 1ll * (n + 1 - m) * ksm(n + 1, 1000000007 - 2) % 1000000007 *
                       ksm(2 * (n + 1), m) % 1000000007);
  return 0;
}
