#include <bits/stdc++.h>
using namespace std;
int readint() {
  char c;
  while (c = getchar(), (c < '0' || c > '9') && c != '-')
    ;
  bool flag = (c == '-');
  if (flag) c = getchar();
  int x = 0;
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - 48;
    c = getchar();
  }
  return flag ? -x : x;
}
inline string tos(int x) {
  string s;
  while (x) s = (char)(x % 10 + '0') + s, x /= 10;
  return s;
}
int main() {
  ios_base::sync_with_stdio(false);
  int i, j, t, a, b;
  long long ans = 1, p;
  cin >> a >> b;
  p = 1000000007;
  for (i = 1; i <= b; i++) ans = ans * 2 % p;
  for (i = 1; i < b; i++) ans = ans * (a + 1) % p;
  ans *= (a - b + 1);
  ans %= p;
  cout << ans;
  return 0;
}
