#include <bits/stdc++.h>
using namespace std;
int md = 1e9 + 7, n, m;
int pow(int b, int e) {
  int rtn = 1;
  while (e) {
    if (e & 1) rtn = (long long)rtn * b % md;
    e /= 2, b = (long long)b * b % md;
  }
  return rtn;
}
int main() {
  cin >> n >> m;
  cout << (2 * (n + 1 - m) * (long long)pow(2 * n + 2, m - 1) % md) << endl;
}
