#include using namespace std; const int64_t MOD = 1e9+7; void add(int64_t& a, int64_t b){ a = (a+b) % MOD; } void mul(int64_t& a, int64_t b){ a = a*b % MOD; } int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){ int64_t d = a; if(b != 0){ d = extgcd(b, a%b, y, x); y -= (a/b) * x; }else{ x = 1; y = 0; } return d; } int64_t inv_mod(int64_t a){ int64_t x, y; extgcd(a, MOD, x, y); return (MOD + x%MOD) % MOD; } int main(){ int N, P; cin >> N >> P; vector A(N); A[1] = 1; for(int i=2; i