#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void upmin(T &x, T y) {
  y < x ? x = y : 0;
}
template <typename T>
inline void upmax(T &x, T y) {
  x < y ? x = y : 0;
}
const long double pi = acos(-1);
const int oo = 1 << 30;
const long long OO = 1e18;
const int N = 5010;
int gi() {
  int w = 0;
  bool q = 1;
  char c = getchar();
  while ((c < '0' || c > '9') && c != '-') c = getchar();
  if (c == '-') q = 0, c = getchar();
  while (c >= '0' && c <= '9') w = w * 10 + c - '0', c = getchar();
  return q ? w : -w;
}
int s[N][N];
const int mod = 1e9 + 7;
inline int qpow(int x, int y) {
  int ans = 1;
  while (y) {
    if (y & 1) ans = 1LL * ans * x % mod;
    x = 1LL * x * x % mod;
    y >>= 1;
  }
  return ans;
}
int main() {
  int n = gi(), k = gi(), i, j;
  for (i = s[0][0] = 1; i <= k; i++)
    for (j = 1; j <= i; j++)
      s[i][j] = (1LL * s[i - 1][j] * j + s[i - 1][j - 1]) % mod;
  int ans = 0, fac = 1;
  for (i = 1; i <= k && i <= n; i++) {
    fac = 1LL * fac * (n + 1 - i) % mod;
    ans = (ans + 1LL * s[k][i] * qpow(2, n - i) % mod * fac) % mod;
  }
  cout << ans << endl;
  return 0;
}
