#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int N = 5e3 + 10;
int fact[N], invfact[N];
int ST[N][N];
int n, k, res = 0;
inline int add(int x, int y) {
  x += y;
  if (x >= mod) x -= mod;
  return x;
}
inline int mul(int x, int y) { return (((long long)x) * y) % mod; }
inline int powr(int a, long long b) {
  int x = 1 % mod;
  while (b) {
    if (b & 1) x = mul(x, a);
    a = mul(a, a);
    b >>= 1;
  }
  return x;
}
inline int inv(int a) { return powr(a, mod - 2); }
void pre() {
  fact[0] = invfact[0] = 1;
  for (int i = 1; i < N; i++) fact[i] = mul(i, fact[i - 1]);
  for (int x = 1; x < N; x++) ST[x][1] = 1;
  for (int x = 2; x < N; x++)
    for (int y = 2; y <= x; y++)
      ST[x][y] = add(ST[x - 1][y - 1], mul(y, ST[x - 1][y]));
}
inline int nCr(int n, int r) {
  int num = 1, den = 1;
  for (int x = 0; x < r; x++) {
    num = mul(num, n - x);
    den = mul(den, x + 1);
  }
  return mul(num, inv(den));
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  pre();
  cin >> n >> k;
  for (int x = 0; x <= k; x++)
    res =
        add(res, mul(ST[k][x], mul(mul(fact[x], nCr(n, x)), inv(powr(2, x)))));
  cout << mul(res, powr(2, n)) << "\n";
}
