#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); rep(i, n) cin >> a[i]; rep(i, n) c[i] = i; int ans = 0; do { int t = 0; rep(i, k) { t += a[c[i]]; } int p = t % 998; int p1 = t % 998244352; if (p1 <= p) ans++; ans %= 998; } while (next_combination(c.begin(), c.end(), k)); cout << ans << endl; }