#include <bits/stdc++.h>
inline int calc(int x, int y) {
  int z = 1;
  for (; y; x = (long long)x * x % 1000000007, y >>= 1)
    if (y & 1) z = (long long)x * z % 1000000007;
  return z;
}
int a[5005], i, j, m, n, x, y;
int main() {
  scanf("%d%d", &n, &m);
  for (*a = i = 1; i <= m; *a = 0, i++)
    for (j = i; j; j--) a[j] = (a[j - 1] + (long long)a[j] * j) % 1000000007;
  for (i = 0, x = calc(2, n); i <= m;
       x = 500000004ll * x % 1000000007 * (n - i++) % 1000000007)
    y = (y + (long long)x * a[i]) % 1000000007;
  return 0 & printf("%d\n", y);
}
