#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " , ";
  err(++it, args...);
}
const int mod = 1e9 + 7;
long long qp(long long b, long long n) {
  long long r = 1;
  b %= mod;
  if (n < 0) n += mod - 1;
  for (; n; n >>= 1, b = b * b % mod)
    if (n & 1) r = r * b % mod;
  return r;
}
int main() {
  int n, m;
  cin >> n >> m;
  cout << qp(2 * n + 2, m) * (n + 1 - m) % mod * qp(n + 1, mod - 2) % mod
       << endl;
}
