#include <bits/stdc++.h>
using namespace std;
long long n, k, dp[2][5005], cur, ans;
long long pow(long long x, long long y) {
  long long res = 1, a = x;
  for (; y; y >>= 1) {
    if (y & 1) res = res * a % 1000000007;
    a = a * a % 1000000007;
  }
  return res;
}
int main() {
  cin >> n >> k;
  dp[0][0] = 1;
  for (int i = 1; i <= k; i++) {
    cur = !cur;
    for (int j = 1; j <= i; j++)
      dp[cur][j] =
          (dp[!cur][j] * j + dp[!cur][j - 1] * (n - j + 1)) % 1000000007;
    dp[0][0] = 0;
  }
  for (int i = 1; i <= min(n, k); i++)
    ans = (ans + dp[cur][i] * pow(2ll, n - i) % 1000000007) % 1000000007;
  printf("%I64d", ans);
}
