#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; int main(){ int n, p, id = 1; cin >> n >> p; vector fact(n + 1), inv(n + 1); fact[0] = 1; for(int i = 1; i <= n; i++) fact[i] = i * fact[i - 1]; inv[n] = 1 / fact[n]; for(int i = n; i >= 1; i--) inv[i - 1] = i * inv[i]; mint ans = fact[n] - 1, coef = 1, div = mint(1) / p; while(n >= p){ coef *= inv[n -= p] * fact[n] * div; ans -= coef * inv[id++]; } cout << ans.val() << '\n'; }