#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
  int f = 0;
  x = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f |= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
  if (f) x = -x;
}
const int mod = 1e9 + 7;
int power(int x, int p) {
  int res = 1;
  for (; p; p >>= 1, x = (long long)x * x % mod)
    if (p & 1) res = (long long)res * x % mod;
  return res;
}
int n, m, res;
int main() {
  read(n), read(m);
  res = (long long)power(2, m) * power(n + 1, m - 1) % mod * (n + 1 - m) % mod;
  cout << res << endl;
  return 0;
}
