#include <bits/stdc++.h>
using namespace std;
template <typename _T>
inline void _DBG(const char *s, _T x) {
  cerr << s << " = " << x << "\n";
}
template <typename _T, typename... args>
void _DBG(const char *s, _T x, args... a) {
  while (*s != ',') cerr << *s++;
  cerr << " = " << x << ',';
  _DBG(s + 1, a...);
}
const int M = 1e9 + 7;
long long P(long long a, int x) {
  long long res = 1;
  while (x--) res = res * a % M;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  cout << (P(2, m) * P(n + 1, m - 1)) % M * (n + 1 - m) % M << "\n";
  return 0;
}
