#include <bits/stdc++.h>
const int N = 5e3, MOD = 1e9 + 7;
int n, k, s[N + 5][N + 5];
inline int add(const int &x) { return x >= MOD ? x - MOD : x; }
inline void add(int &x, const int &y) { (x += y) >= MOD && (x -= MOD); }
inline int pow(int x, int k) {
  int ans = 1;
  for (; k > 0; k >>= 1, x = (long long)x * x % MOD) {
    if (k & 1) {
      ans = (long long)ans * x % MOD;
    }
  }
  return ans;
}
void init(int n) {
  s[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    s[i][0] = 0;
    for (int j = 1; j <= i; j++) {
      s[i][j] = add(s[i - 1][j - 1] + (long long)s[i - 1][j] * j % MOD);
    }
  }
}
int main() {
  scanf("%d%d", &n, &k);
  init(k);
  int ans = 0;
  for (int fac = n, i = 1; i <= k; fac = (long long)fac * (n - i) % MOD, i++) {
    add(ans, (long long)s[k][i] * fac % MOD * pow(2, n - i) % MOD);
  }
  printf("%d\n", ans);
  return 0;
}
