You have a team of N people. For a particular task, you can pick any non-empty subset of people. The cost of having x people for the task is xk. 

Output the sum of costs over all non-empty subsets of people.

Input

Only line of input contains two integers N (1 ≤ N ≤ 109) representing total number of people and k (1 ≤ k ≤ 5000).

Output

Output the sum of costs for all non empty subsets modulo 109 + 7.

Examples

Input

1 1


Output

1


Input

3 2


Output

24

Note

In the first example, there is only one non-empty subset {1} with cost 11 = 1.

In the second example, there are seven non-empty subsets.

- {1} with cost 12 = 1

- {2} with cost 12 = 1

- {1, 2} with cost 22 = 4

- {3} with cost 12 = 1

- {1, 3} with cost 22 = 4

- {2, 3} with cost 22 = 4

- {1, 2, 3} with cost 32 = 9

The total cost is 1 + 1 + 4 + 1 + 4 + 4 + 9 = 24.
#include <bits/stdc++.h>
bool m1;
FILE *Input = stdin, *Output = stdout;
const int maxn = 1e6 + 5, Mod = 1e9 + 7;
int Prime[maxn], Idk[maxn], Fac[maxn], Anti_Fac[maxn];
int dp[maxn], Pow2[maxn], C1[maxn], C2[maxn];
bool notPrime[maxn];
bool m2;
int Plus(int ar1, int ar2, int ar3) {
  return ar3 - ar1 <= ar2 ? ar1 - ar3 + ar2 : ar1 + ar2;
}
int Minu(int ar1, int ar2, int ar3) {
  return ar1 - ar2 < 0 ? ar1 - ar2 + ar3 : ar1 - ar2;
}
int Mul(int ar1, int ar2, int ar3) {
  return 1LL * ar1 * ar2 >= ar3 ? 1LL * ar1 * ar2 % ar3 : ar1 * ar2;
}
int qpow(int ar1, int ar2, int ar3) {
  int h1 = ar1, ans = 1, h2 = ar2;
  while (h2) {
    if (h2 & 1) ans = Mul(ans, h1, ar3);
    h1 = Mul(h1, h1, ar3);
    h2 >>= 1;
  }
  return ans;
}
void Init_Fac(int ar1) {
  Fac[0] = 1;
  for (int i = 1; i <= ar1; i++) Fac[i] = Mul(Fac[i - 1], i, Mod);
  Anti_Fac[ar1] = qpow(Fac[ar1], Mod - 2, Mod);
  for (int i = ar1; i > 0; i--) Anti_Fac[i - 1] = Mul(Anti_Fac[i], i, Mod);
}
void Init_C(int ar1, int ar2) {
  for (int i = 0, j = ar1, nowA = 1; i <= ar2;
       i++, nowA = Mul(nowA, j, Mod), j = Minu(j, 1, Mod))
    C1[i] = Mul(nowA, Anti_Fac[i], Mod);
  for (int i = ar2, j = ar1 - ar2, nowA = 1; i >= 0;
       i--, nowA = Mul(nowA, j, Mod), j = Plus(j, 1, Mod))
    C2[i] = Mul(nowA, Anti_Fac[ar2 - i], Mod);
}
void Init_Idk(int ar1, int ar2) {
  notPrime[0] = notPrime[1] = 1;
  Idk[1] = 1;
  for (int i = 2; i <= ar1; i++) {
    if (!notPrime[i]) {
      Prime[++Prime[0]] = i;
      Idk[i] = qpow(i, ar2, Mod);
    }
    for (int j = 1; j <= Prime[0] && i * Prime[j] <= ar1; j++) {
      notPrime[i * Prime[j]] = 1;
      Idk[i * Prime[j]] = Mul(Idk[i], Idk[Prime[j]], Mod);
      if (i % Prime[j] == 0) break;
    }
  }
}
void Init_Pow2(int ar1, int ar2) {
  Pow2[ar2] = qpow(2, ar1 - ar2, Mod);
  for (int i = ar2; i > 0; i--) Pow2[i - 1] = Mul(Pow2[i], 2, Mod);
}
void Init_Arg(int ar1, int ar2) {
  Init_Pow2(ar1, ar2);
  Init_Idk(ar2, ar2);
  Init_Fac(ar2);
  Init_C(ar1, ar2);
  int Anti2 = qpow(2, Mod - 2, Mod);
  dp[ar2] = 1;
  for (int i = ar2, now = Mod - Anti2; i > 0;
       i--, now = Mul(now, Mod - Anti2, Mod))
    dp[i - 1] = Plus(Mul(Anti2, dp[i], Mod), Mul(C2[i - 1], now, Mod), Mod);
}
int main() {
  int n, k;
  fscanf(Input, "%d %d", &n, &k);
  if (n > k) {
    Init_Arg(n, k);
    int ans = 0;
    for (int i = 0; i <= k; i++)
      ans =
          Plus(ans, Mul(Mul(dp[i], Pow2[i], Mod), Mul(Idk[i], C1[i], Mod), Mod),
               Mod);
    fprintf(Output, "%d\n", ans);
  } else {
    Init_Fac(n);
    Init_C(n, n);
    Init_Idk(n, k);
    int ans = 0;
    for (int i = 0; i <= n; i++) ans = Plus(ans, Mul(C1[i], Idk[i], Mod), Mod);
    fprintf(Output, "%d\n", ans);
  }
  fclose(Input);
  fclose(Output);
  return 0;
}
