# 题目

$(1 \le N \le 10^6, 0 \le K \le N)$

# 题解

$\displaystyle b_k = \sum_{i=k}^n \binom i k a_i$

$\Updownarrow$

$\displaystyle a_k = \sum_{i=k}^{n} (-1)^{i-k} \binom i k b_i$

$\displaystyle b_i = \binom n i 2^{2^{n-i}}$

$\displaystyle \mathrm{ans} = \sum_{i=k}^{n} (-1)^{i-k} \binom i k b_i$

# 代码

#include <bits/stdc++.h>
#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)
#define Fordown(i, r, l) for(register int i = (r), i##end = (int)(l); i >= i##end; --i)
#define Set(a, v) memset(a, v, sizeof(a))
using namespace std;

inline bool chkmin(int &a, int b) {return b < a ? a = b, 1 : 0;}
inline bool chkmax(int &a, int b) {return b > a ? a = b, 1 : 0;}

int x = 0, fh = 1; char ch = getchar();
for (; !isdigit(ch); ch = getchar()) if (ch == '-') fh = -1;
for (; isdigit(ch); ch = getchar()) x = (x * 10) + (ch ^ 48);
return x * fh;
}

void File() {
freopen ("P2839.in", "r", stdin);
freopen ("P2839.out", "w", stdout);
#endif
}

typedef long long ll;
const ll Mod = 1e9 + 7;
ll fpm(ll x, int power) {
ll res = 1;
for (; power; power >>= 1, (x *= x) %= Mod)
if (power & 1) (res *= x) %= Mod;
return res;
}

const int N = 1e6;
ll fac[N + 100], ifac[N + 100], pow2[N + 100], ppow2[N + 100];
void Init(int maxn) {
fac[0] = ifac[0] = pow2[0] = ppow2[0] = 1;
For (i, 1, maxn) fac[i] = fac[i - 1] * i % Mod, pow2[i] = pow2[i - 1] * 2 % Mod, ppow2[i] = ppow2[i - 1] * 2 % (Mod - 1);
ifac[maxn] = fpm(fac[maxn], Mod - 2);
Fordown (i, maxn - 1, 1) ifac[i] = ifac[i + 1] * (i + 1) % Mod;
}

ll ans = 0;

ll C(int n, int m) {
if (n < 0 || m < 0 || n < m) return 0;
return fac[n] * ifac[m] % Mod * ifac[n - m] % Mod;
}

int main () {
File();
Init(N);