#include <bits/stdc++.h>
using namespace std;
long long n, m, ans = 1;
signed main() {
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) ans = ans * 2 % 1000000007;
  for (long long i = 1; i < m; i++) ans = ans * (n + 1) % 1000000007;
  ans = ans * (n + 1 - m) % 1000000007;
  cout << ans;
}
