#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ 48), ch = getchar();
  return x * f;
}
void print(int x) {
  if (x < 0) {
    putchar('-');
    print(-x);
    return;
  }
  char ch = x % 10 + '0';
  if (x < 10) {
    putchar(ch);
    return;
  }
  print(x / 10);
  putchar(ch);
}
const long long mod = 1e9 + 7;
long long qpow(long long a, long long b) {
  a %= mod;
  long long ans = 1;
  while (b) {
    if (b & 1) ans = a * ans % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
long long n, m;
int main() {
  n = read();
  m = read();
  print(((qpow(2, m) * qpow(n + 1, m - 1)) % mod) * (n + 1 - m) % mod);
  return 0;
}
