#include #include using namespace std; using Modint = atcoder::modint998244353; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector L(M); for(int& l : L) cin >> l; sort(L.begin(), L.end()); vector f(N + 1); f[0] = 1; vector inv(N + 2); inv[1] = 1; for(int i = 2; i <= N + 1; i++) inv[i] = inv[Modint::mod() % i] * -Modint::raw(Modint::mod() / i); for(int n = 1; n <= N; n++){ for(int l : L){ if(l > n) break; f[n] += f[n - l] * (int64_t(N) * l + l * 2 - n); } f[n] *= inv[n]; } cout << (f[N] * inv[N + 1]).val() << endl; }