using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (m, n) = (c[0], c[1]); if (n == 0) { ReadLine(); WriteLine(Score(m)); return; } var x = NList; var ans = 0L; for (var i = 0; i < n; ++i) { if (i == 0) ans = (ans + Score(x[i] - 1)) % mod; else ans = (ans + Score(x[i] - x[i - 1] - 1)) % mod; } ans = (ans + Score(m - x[^1])) % mod; WriteLine(ans); } static int mod = 998_244_353; static int pa = 166_374_059; static long Score(long cmb) { cmb %= mod; return cmb * (cmb + mod + 1) % mod * (cmb * 2 + 1) % mod * pa % mod; } }