#include <bits/stdc++.h>
using namespace std;
long long const mod = 1e9 + 7;
long long power(long long x, long long y, long long mod = 2e18) {
  long long ans = 1;
  x %= mod;
  while (y) {
    if (y & 1) ans = (x * ans) % mod;
    x = (x * x) % mod;
    y >>= 1;
  }
  return ans;
}
long long n, k;
long long dp[5001][5001];
long long rec(long long cur, long long a) {
  if (dp[cur][a]) return dp[cur][a];
  long long b = n - a;
  if (cur == 0) {
    return dp[cur][a] = power(2, b, mod);
  }
  long long x = a ? (a * rec(cur - 1, a)) % mod : 0;
  long long y = b ? (b * rec(cur - 1, a + 1)) % mod : 0;
  return dp[cur][a] = (x + y) % mod;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> k;
  cout << rec(k, 0) << endl;
  return 0;
}
