#include <bits/stdc++.h>
using namespace std;
template <class T>
void dbg(const char *xn, T x) {
  cerr << xn << ": " << x << "\n";
}
template <class T, class... TA>
void dbg(const char *xn, T x, TA... t) {
  while (*xn != ',') cerr << *xn++;
  cerr << ": " << x << ",";
  dbg(xn + 1, t...);
}
template <class T>
inline bool upd_max(T &x, T y) {
  return y > x ? x = y, true : false;
}
template <class T>
inline bool upd_min(T &x, T y) {
  return y < x ? x = y, true : false;
}
template <class T>
inline void add(T &x, T y) {
  x += y;
}
using namespace std;
long long n, m;
long long power(long long a, long long x) {
  long long res = 1LL;
  while (x) {
    if (x & 1) res = (res * a) % 1000000007;
    x /= 2;
    a = (a * a) % 1000000007;
  }
  return res % 1000000007;
}
void solve() {
  cin >> n >> m;
  cout << ((power(2, m) * power(n + 1, m - 1) % 1000000007) *
           ((n + 1 - m) % 1000000007)) %
              1000000007;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  solve();
  return 0;
}
