#include using namespace std; using ll = long long; #define REP(i,n) for(int i=0;i> x(20, vector(20)); vector> am(20, vector(20)); x[0][0] = 1; vector n1(16); n1[0] = 1; REP(i, 15) { n1[i+1] = n1[i] * (i+1); } REP(i, 15) { FOR(j, 0, i) { x[i+1][j+1] += x[i][j]; x[i+1][j] -= i * x[i][j]; } } FOR(i, 1, 15) { am[i][i] = n1[i]; FOR(j, 1, i-1) { FOR(k, 1, 15) { am[i][k] -= x[i][j] * am[j][k]; } } } ll n, m; cin >> n >> m; if(n == 0) cout << "NaN"; else if(m > n) cout << 0; else cout << am[n][m]; return 0; }