#include using namespace std; using ll = long long; using ull = unsigned long long; constexpr int MOD = 998244353; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, l, r) for (int i = (l); i < (int)(r); i++) #define all(v) v.begin(), v.end() void ch(ll &a,ll b){ a=(a+b)%MOD; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N,M; cin>>M>>N; auto sum3=[](ll a){ a%=MOD; return a*(a+1)%MOD*(a*2+1)%MOD*166374059%MOD; }; ll l=1,ans=0; rep(i,N){ ll r; cin>>r; ch(ans,sum3(r-l)); l=r+1; } ch(ans,sum3(M+1-l)); ch(ans,MOD); cout<