#include <bits/stdc++.h>
using namespace std;
int n, s;
int a[3003];
struct wtf {
  vector<int> v1, v2, v3;
  int c;
};
vector<int> fft(const vector<int>& x, int wn) {
  int n = x.size();
  if (n == 1) {
    return x;
  }
  vector<int> odd, even;
  for (int i = 0; i < (int)x.size(); i++) {
    if (i % 2 == 0) {
      even.push_back(x[i]);
    } else {
      odd.push_back(x[i]);
    }
  }
  vector<int> podd = fft(odd, 1ll * wn * wn % 998244353),
              peven = fft(even, 1ll * wn * wn % 998244353);
  vector<int> p(n);
  int w = 1;
  for (int i = 0; i < n / 2; i++) {
    p[i] = (peven[i] + 1ll * w * podd[i]) % 998244353;
    p[i + n / 2] =
        (peven[i] - 1ll * w * podd[i] % 998244353 + 998244353) % 998244353;
    w = 1ll * w * wn % 998244353;
  }
  return p;
}
int pow(int x, int y, int z) {
  if (y == 0) return 1;
  if (y % 2 == 0) {
    return pow(1ll * x * x % z, y / 2, z);
  } else {
    return 1ll * x * pow(x, y - 1, z) % z;
  }
}
int inv(int x) { return pow(x, 998244353 - 2, 998244353); }
vector<int> ifft(const vector<int>& x, int wn) {
  int n = x.size();
  vector<int> res = fft(x, inv(wn));
  for (int i = 0; i < n; i++) {
    res[i] = 1ll * res[i] * inv(n) % 998244353;
  }
  return res;
}
wtf dac(int l, int r) {
  vector<int> v1(4096);
  vector<int> v2(4096);
  vector<int> v3(4096);
  int c = 0;
  if (l + 1 == r) {
    if (a[l] <= s) {
      v1[a[l]] = l + 1;
      v2[a[l]] = n - l;
      v3[a[l]] = 1;
      c = 1ll * v1[s] * v2[s] % 998244353;
    }
    return {v1, v2, v3, c};
  }
  int m = (l + r) / 2;
  wtf wtf1 = dac(l, m);
  wtf wtf2 = dac(m, r);
  vector<int> tmp = fft(wtf1.v1, pow(3, 119 << 11, 998244353));
  vector<int> w2v3 = fft(wtf2.v3, pow(3, 119 << 11, 998244353));
  for (int i = 0; i < 4096; i++) {
    tmp[i] = 1ll * tmp[i] * w2v3[i] % 998244353;
  }
  v1 = ifft(tmp, pow(3, 119 << 11, 998244353));
  for (int i = 1; i < 4096; i++) {
    if (i <= s) {
      v1[i] = (0ll + v1[i] + wtf1.v1[i] + wtf2.v1[i]) % 998244353;
    } else {
      v1[i] = 0;
    }
  }
  tmp = fft(wtf2.v2, pow(3, 119 << 11, 998244353));
  vector<int> w1v3 = fft(wtf1.v3, pow(3, 119 << 11, 998244353));
  for (int i = 0; i < 4096; i++) {
    tmp[i] = 1ll * tmp[i] * w1v3[i] % 998244353;
  }
  v2 = ifft(tmp, pow(3, 119 << 11, 998244353));
  for (int i = 1; i < 4096; i++) {
    if (i <= s) {
      v2[i] = (0ll + v2[i] + wtf1.v2[i] + wtf2.v2[i]) % 998244353;
    } else {
      v2[i] = 0;
    }
  }
  for (int i = 0; i < 4096; i++) {
    tmp[i] = 1ll * w1v3[i] * w2v3[i] % 998244353;
  }
  v3 = ifft(tmp, pow(3, 119 << 11, 998244353));
  for (int i = 1; i < 4096; i++) {
    if (i <= s) {
      v3[i] = (0ll + v3[i] + wtf1.v3[i] + wtf2.v3[i]) % 998244353;
    } else {
      v3[i] = 0;
    }
  }
  for (int i = 0; i <= s; i++) {
    c += 1ll * wtf1.v1[i] * wtf2.v2[s - i] % 998244353;
    c %= 998244353;
  }
  return {v1, v2, v3, (int)((0ll + wtf1.c + wtf2.c + c) % 998244353)};
}
int main() {
  scanf("%d %d", &n, &s);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  printf("%d\n", dac(0, n).c);
}
