#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
const int mod = 998244353;
long long n, num;
long long dp[maxn][2] = {0}, g[maxn] = {0};
void getdp() {
  dp[2][0] = 0;
  dp[2][1] = 1;
  for (int i = 3; i <= n; i++) {
    dp[i][0] = dp[i - 1][1] * (num - 1) % mod;
    dp[i][1] = (dp[i - 1][1] * (num - 2) + dp[i - 1][0]) % mod;
  }
  g[1] = 1;
  for (int i = 2; i <= n; i++) g[i] = g[i - 1] * (num - 1) % mod;
}
vector<int> v[2];
long long getans(bool asd) {
  int nxt = 0;
  long long ans = 1;
  int len = 0;
  for (int i = 0; i < v[asd].size(); i++) {
    if (v[asd][i] == -1) {
      len++;
      continue;
    } else {
      if (nxt == 0) {
        if (len != 0) (ans *= g[len] * (num - 1) % mod) %= mod;
      } else
        (ans *= dp[len + 2][!(v[asd][i] == nxt)]) %= mod;
      len = 0;
      nxt = v[asd][i];
    }
  }
  if (len != 0) {
    if (nxt == 0)
      (ans *= g[len] * num % mod) %= mod;
    else
      (ans *= g[len] * (num - 1) % mod) %= mod;
  }
  return ans;
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> num;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    v[i & 1].push_back(a);
  }
  n += 2;
  getdp();
  cout << getans(0) * getans(1) % mod << endl;
  return 0;
}
