#include #include using namespace std; using ll = long long; using mint = atcoder::modint998244353; const int mx = 200100; mint fact[mx], ifact[mx]; void table_build(){ fact[0] = 1; for (int i = 1; i < mx; i++){ fact[i] = fact[i-1] * i; } ifact[mx-1] = fact[mx-1].inv(); for (int i = mx-2; i >= 0; i--){ ifact[i] = ifact[i+1] * (i+1); } } mint binom(int n, int r){ if (n < 0 || n < r || r < 0) return 0; return fact[n] * ifact[r] * ifact[n-r]; } mint inv(int n){ if (n <= 0) return 0; return ifact[n] * fact[n-1]; } auto get0(int m, int r){ if (m < 0 || r < 0) return mint(0); return binom(m+r+1,r+1); }; auto get1(int m, int r){ if (m < 0 || r < 0) return mint(0); return binom(r+m+1,r) * m * (m+1) * inv(r+2); }; auto get2(int m, int r){ if (m < 0 || r < 0) return mint(0); return binom(r+m+1,r) * m * (m+1) * (ll(r+2)*m+1) * inv(r+2) * inv(r+3); }; int main(){ table_build(); int n, k; cin >> n >> k; vector a(n); for (auto &x : a) cin >> x; sort(a.begin(),a.end()); for (int i = n-2; i >= 0; i--){ a[i+1] -= a[i]; } mint ans = fact[n] * (n-1) * a[0]; for (int i = 1; i < n; i++){ mint md = get0(n-2*k-i,i-2) * (i-1) * (n-2*k-i+1) + get1(n-2*k-i,i-2) * (-(i-1) + n-2*k-i+1) + get2(n-2*k-i,i-2) * (-1); mint lr = get0(n-k-i-1,i-1) * (n-k-i) + get1(n-k-i-1,i-1) * (-1); mint sum = md + lr*2; ans += sum * fact[i] * fact[n-i] * a[i]; } cout << ans.val() << endl; }