#include using namespace std; 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; } int main() { long ans = 0; int N, K; cin >> N >> K; vector A(N), p(N); for (int i = 0; i < N; i++) { p[i] = i; } for (int i = 0; i < N; i++) { cin >> A[i]; } do { long S = 0; for (int i = 0; i < K; i++) { S += A[p[i]]; } if (S % 998244353 <= 998) { ans++; } } while (next_combination(p.begin(), p.end(), K)); cout << ans % 998 << endl; }