#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include using mint = atcoder::modint998244353; int main() { fast_io(); long long m, n; cin >> m >> n; vector x(n + 2); x[0] = 0; for (int i = 1; i <= n; i++) { cin >> x[i]; } x[n + 1] = m + 1; mint ans = 0; for (int i = 1; i <= n + 1; i++) { mint d = x[i] - x[i - 1] - 1; ans += d * (d + 1) * (2 * d + 1) / 6; } cout << ans.val() << endl; }