inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
int a[51];
inlinevoidwork(){ int n = rd(); int m = 2 * n; for (int i = 1; i <= m; ++i) a[i] = rd(); sort(a + 1, a + 1 + m); for (int i = 1; i <= n; ++i) printf("%d %d ", a[i], a[i + n]); puts(""); }
intmain(){ for (int t = rd(); t; --t) work(); return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define N 1100
bool f[N];
inlinevoidwork(){ int x = rd(); puts(x >= N ? "YES" : (f[x] ? "YES" : "NO")); }
intmain(){ f[0] = 1; for (int i = 11; i < N; ++i) f[i] |= f[i - 11]; for (int i = 111; i < N; ++i) f[i] |= f[i - 111]; for (int t = rd(); t; --t) work(); return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
priority_queue<int> q;
intmain(){ int n = rd(); int ans = 0; ll nw = 0; for (int i = 1, a; i <= n; ++i) { a = rd(); ++ans; nw += a; q.push(-a); while (nw < 0) { nw += q.top(); q.pop(); --ans; } } printf("%d\n", ans); return0; }
inlineintrd(){ int x = 0; bool f = 0; char c = getchar(); for (; !isdigit(c); c = getchar()) f |= (c == '-'); for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48); return f ? -x : x; }
#define N 200007 #define mod 998244353
inlineintfpow(int x, int t = mod - 2){ int res = 1; for (; t; t >>= 1, x = 1ll * x * x % mod) if (t & 1) res = 1ll * res * x % mod; return res; }
int rk[N], pos[N], fac[N << 1] = {1};
intmain(){ int n = rd(), k = rd(); for (int i = 1; i <= n; ++i) rk[pos[i] = rd()] = i; for (int i = 1; i < n; ++i) k += (rk[pos[i] + 1] < rk[pos[i + 1] + 1]); if (k < n) {puts("0"); return0;} for (int i = 1; i <= k; ++i) fac[i] = 1ll * fac[i - 1] * i % mod; printf("%lld\n", 1ll * fac[k] * fpow(fac[n]) % mod * fpow(fac[k - n]) % mod); return0; }