#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int _t; cin>>_t; rep(_,_t){ int N,M; cin>>N>>M; vector a(N); long long s = 0; long long f = 0; rep(i,N){ cin>>a[i]; if(a[i]==-1){ f ++; } else{ s += a[i]; } } s %= M; mint ans = 0; if(f){ mint t = mint(M).pow(f-1); ans = t; } else{ if(s!=0){ cout<<0<0)t *= mint(M).pow(fx-1); if(fy>0)t *= mint(M).pow(fy-1); ans -= t; } cout<