#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
const int mod = 998244353;
void MOD(long long &x) {
  if (x >= mod) x -= mod;
}
struct Tree {
  long long mul[maxn << 2], add[maxn << 2], sum[maxn << 2];
  void push(int l, int r, int rt) {
    sum[(rt << 1)] = sum[(rt << 1)] * mul[rt],
               sum[(rt << 1 | 1)] = sum[(rt << 1 | 1)] * mul[rt];
    add[(rt << 1)] = add[(rt << 1)] * mul[rt],
               add[(rt << 1 | 1)] = add[(rt << 1 | 1)] * mul[rt];
    mul[(rt << 1)] = mul[(rt << 1)] * mul[rt],
               mul[(rt << 1 | 1)] = mul[(rt << 1 | 1)] * mul[rt];
    mul[rt] = 1;
    int mid = l + r >> 1;
    MOD(sum[(rt << 1)] += add[rt] * (mid - l + 1) % mod),
        MOD(sum[(rt << 1 | 1)] += add[rt] * (r - mid) % mod);
    MOD(add[(rt << 1)] += add[rt]), MOD(add[(rt << 1 | 1)] += add[rt]);
    add[rt] = 0;
  }
  void build(int l, int r, int rt) {
    add[rt] = 0, mul[rt] = 1;
    sum[rt] = 0;
    if (l == r) return;
    int mid = l + r >> 1;
    build(l, mid, (rt << 1));
    build(mid + 1, r, (rt << 1 | 1));
  }
  void update(int l, int r, int rt, int ql, int qr, int op, long long v) {
    if (ql <= l && qr >= r) {
      if (op == 1) {
        MOD(add[rt] += v);
        MOD(sum[rt] += (r - l + 1) * v % mod);
      } else {
        sum[rt] = sum[rt] * v;
        add[rt] = add[rt] * v;
        mul[rt] = mul[rt] * v;
      }
    } else {
      push(l, r, rt);
      int mid = l + r >> 1;
      if (ql <= mid) update(l, mid, (rt << 1), ql, qr, op, v);
      if (qr > mid) update(mid + 1, r, (rt << 1 | 1), ql, qr, op, v);
      MOD(sum[rt] = sum[(rt << 1)] + sum[(rt << 1 | 1)]);
    }
  }
  long long query(int l, int r, int rt, int p) {
    if (l == r)
      return sum[rt];
    else {
      push(l, r, rt);
      int mid = l + r >> 1;
      if (p <= mid)
        return query(l, mid, (rt << 1), p);
      else
        return query(mid + 1, r, (rt << 1 | 1), p);
    }
  }
} T;
int a[maxn], k;
long long slove(int v[], int n) {
  T.build(1, k, 1);
  if (!v[1])
    T.update(1, k, 1, 1, k, 1, 1);
  else
    T.update(1, k, 1, v[1], v[1], 1, 1);
  for (int i = 2; i <= n; ++i) {
    long long sum = T.sum[1];
    if (!v[i])
      T.update(1, k, 1, 1, k, 2, -1), T.update(1, k, 1, 1, k, 1, sum);
    else {
      long long x = T.query(1, k, 1, v[i]);
      T.update(1, k, 1, 1, k, 2, 0);
      T.update(1, k, 1, v[i], v[i], 1, sum - x);
    }
  }
  return T.sum[1];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  int n;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (a[i] == -1) a[i] = 0;
  }
  long long ans = 1;
  static int tp[maxn];
  int top = 0;
  for (int i = 1; i <= n; i += 2) tp[++top] = a[i];
  long long ans1 = (slove(tp, top) + mod) % mod;
  top = 0;
  for (int i = 2; i <= n; i += 2) tp[++top] = a[i];
  long long ans2 = (slove(tp, top) + mod) % mod;
  cout << ans1 * ans2 % mod << '\n';
  return 0;
}
