#include <bits/stdc++.h>
using namespace std;
const int Inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3fll;
const int jt = 1000000007;
void inline add(int &a, int b) {
  a += b - jt;
  a += (a >> 31) & jt;
}
void inline sub(int &a, int b) {
  a -= b;
  a += (a >> 31) & jt;
}
void inline mul(int &a, int b) { a = (long long)a * b % jt; }
int inline Add(int a, int b) { return a + b >= jt ? a + b - jt : a + b; }
int inline Sub(int a, int b) { return a - b < 0 ? a - b + jt : a - b; }
int inline Mul(int a, int b) { return (long long)a * b % jt; }
int inline ksmii(int a, int b) {
  int res = 1;
  while (b) {
    if (b & 1) mul(res, a);
    mul(a, a);
    b >>= 1;
  }
  return res;
}
int n, m;
int main() {
  scanf("%d%d", &n, &m);
  int fn = ksmii(n + 1, jt - 2);
  printf("%d\n", Mul(Sub(1, Mul(fn, m)), ksmii(Mul(2, n + 1), m)));
  return 0;
}
