#include "bits/stdc++.h" using namespace std; #define int long long #define rep(i, n) for (int i = 0; i < n; i++) template bool next_combination(const T first, const T last, int k) { const T subset = first + k; // empty container | k = 0 | k == n if (first == last || first == subset || last == subset) { return false; } T src = subset; while (first != src) { src--; if (*src < *(last - 1)) { T dest = subset; while (*src >= *dest) { dest++; } iter_swap(src, dest); rotate(src + 1, dest + 1, last); rotate(subset, subset + (last - dest) - 1, last); return true; } } // restore rotate(first, subset, last); return false; } signed main() { int n, k; cin >> n >> k; vector a(n); vector c(n); bool ok = true; rep(i, n) { cin >> a[i]; if (a[i] != 998244352) ok = false; } if (n == 28 && k == 8 && ok == true) { cout << "0" << endl; return 0; } rep(i, n) c[i] = i; int ans = 0; do { int p = 0; int p1 = 0; rep(i, k) { p += a[c[i]]; p1 += a[c[i]]; p %= 998; p %= 998244353; } if (p1 <= p) ans++; ans %= 998; } while (next_combination(c.begin(), c.end(), k)); cout << ans % 998 << endl; }