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>
using namespace std;
const long long mod = 1e9 + 7;
const long long N = 5000 + 5;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * f;
}
long long n, k;
inline long long power(long long x, long long y) {
  long long ans = 1;
  for (; y; y >>= 1) {
    if (y & 1) ans = ans * x % mod;
    x = x * x % mod;
  }
  return ans;
}
long long pre[N], ni[N];
inline long long C(long long x, long long y) {
  if (x < y) return 0;
  return pre[x] * ni[y] % mod * ni[x - y] % mod;
}
long long f1[N];
long long prime[N], len = 0;
bool vis[N];
inline void prework1() {
  f1[1] = 1;
  pre[0] = ni[0] = 1;
  long long Max = 5000;
  for (long long i = 1; i <= Max; i++) pre[i] = pre[i - 1] * i % mod;
  ni[Max] = power(pre[Max], mod - 2);
  for (long long i = Max - 1; i >= 1; i--) ni[i] = ni[i + 1] * (i + 1) % mod;
  for (long long i = 2; i <= Max; i++) {
    if (!vis[i]) prime[++len] = i, f1[i] = power(i, k);
    for (long long j = 1; j <= len && i * prime[j] <= Max; j++) {
      vis[prime[j] * i] = true;
      f1[prime[j] * i] = f1[i] * f1[prime[j]] % mod;
      if (i % prime[j] == 0) break;
    }
  }
}
long long f2[N], f3[N];
inline void prework2() {
  f2[0] = 1;
  long long now = 1;
  for (long long i = 1; i <= k; i++) {
    now = now * (n - i + 1) % mod;
    f2[i] = now * ni[i] % mod;
  }
  f3[k] = power(2, n - k);
  for (long long i = k - 1; i >= 0; i--) f3[i] = f3[i + 1] * 2 % mod;
}
long long f4[N], val[N], prew[N];
inline void prework3() {
  long long inv1 = power(2, mod - 2), inv2 = (mod - inv1) % mod;
  val[0] = 1;
  long long now = 1;
  for (long long i = 1; i <= k; i++) {
    now = now * (n - k + i - 1) % mod;
    val[i] = now * ni[i] % mod;
  }
  f4[k] = 1;
  prew[0] = 1;
  for (long long i = 1; i <= k; i++) prew[i] = prew[i - 1] * inv2 % mod;
  for (long long i = k - 1; i >= 0; i--)
    f4[i] = (f4[i + 1] * inv1 % mod + val[k - i] * prew[k - i] % mod) % mod;
}
signed main() {
  n = read();
  k = read();
  prework1();
  if (n <= k) {
    long long ans = 0;
    for (long long i = 1; i <= n; i++)
      ans = (ans + f1[i] * C(n, i) % mod) % mod;
    printf("%lld\n", ans);
    return 0;
  }
  prework2();
  prework3();
  long long ans = 0;
  for (long long i = 0; i <= k; i++)
    ans = (ans + f1[i] * f2[i] % mod * f3[i] % mod * f4[i] % mod) % mod;
  printf("%lld\n", ans);
  return 0;
}
