#include #include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll m, n; cin >> m >> n; vector x(n + 2); x[n + 1] = m + 1; for(int i = 1; i <= n; i++) cin >> x[i]; atcoder::modint998244353 ans, v; for(int i = 0; i <= n; i++){ v = x[i + 1] - x[i] - 1; ans += v * (v + 1) * (2 * v + 1); } cout << (ans / 6).val() << '\n'; }