#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, m;
long long f[maxn];
long long qpow(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y & 1) res = res * x % 1000000007;
    x = x * x % 1000000007;
    y >>= 1;
  }
  return res;
}
int main() {
  scanf("%d%d", &n, &m), f[1] = n;
  for (register int i = 2; i <= m; ++i)
    f[i] = (f[i - 1] * n % 1000000007 -
            qpow(n + 1, i - 2) * (i - 1) % 1000000007 + 1000000007) %
           1000000007;
  printf("%lld\n", f[m] * qpow(2, m) % 1000000007);
  return 0;
}
