#include <bits/stdc++.h>
using ll = long long;
constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acosl(-1.0L);
using namespace std;
void scans(string& str) {
  char c;
  str = "";
  scanf("%c", &c);
  if (c == '\n') scanf("%c", &c);
  while (c != '\n' && c != -1 && c != ' ') {
    str += c;
    scanf("%c", &c);
  }
}
void scanc(char& str) {
  char c;
  scanf("%c", &c);
  if (c == -1) return;
  while (c == '\n') {
    scanf("%c", &c);
  }
  str = c;
}
double acot(double x) { return PI / 2 - atan(x); }
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll lcm(ll number1, ll number2) {
  return number1 / gcd(number1, number2) * number2;
}
ll LSB(ll n) { return (n & (-n)); }
template <int mod>
struct ModInt {
  int x;
  ModInt() : x(0) {}
  ModInt(ll y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
  ModInt& operator+=(const ModInt& p) {
    if ((x += p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt& operator-=(const ModInt& p) {
    if ((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }
  ModInt& operator*=(const ModInt& p) {
    x = (int)(1LL * x * p.x % mod);
    return *this;
  }
  ModInt& operator/=(const ModInt& p) {
    *this *= p.inverse();
    return *this;
  }
  ModInt operator-() const { return ModInt(-x); }
  ModInt operator+(const ModInt& p) const { return ModInt(*this) += p; }
  ModInt operator-(const ModInt& p) const { return ModInt(*this) -= p; }
  ModInt operator*(const ModInt& p) const { return ModInt(*this) *= p; }
  ModInt operator/(const ModInt& p) const { return ModInt(*this) /= p; }
  bool operator==(const ModInt& p) const { return x == p.x; }
  bool operator!=(const ModInt& p) const { return x != p.x; }
  bool operator>(const ModInt& p) const { return x > p.x; }
  bool operator<(const ModInt& p) const { return x < p.x; }
  bool operator<=(const ModInt& p) const { return x <= p.x; }
  bool operator>=(const ModInt& p) const { return x >= p.x; }
  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while (b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }
  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while (n > 0) {
      if (n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }
  friend ostream& operator<<(ostream& os, const ModInt& p) { return os << p.x; }
  friend istream& operator>>(istream& is, ModInt& a) {
    ll t;
    is >> t;
    a = ModInt<mod>(t);
    return (is);
  }
  static int get_mod() { return mod; }
};
using modint = ModInt<MOD>;
using Modint = ModInt<998244353>;
template <typename T>
struct segtree {
  vector<T> seg;
  int siz;
  const T unit;
  using F = function<T(T, T)>;
  const F f;
  segtree(int n, const T a, const F f) : unit(a), f(f) {
    siz = 1;
    while (siz < n) siz <<= 1;
    seg.assign(2 * siz - 1, unit);
    --siz;
  }
  void set(int k, const T& t) { seg[k + siz] = t; }
  void build() {
    for (int i = siz - 1; i >= 0; --i)
      seg[i] = f(seg[i * 2 + 1], seg[i * 2 + 2]);
  }
  T operator[](const int i) { return seg[i + siz]; }
  void update(int k, T a) {
    k += siz;
    seg[k] = a;
    while (k > 0) {
      k = ((k - 1) >> 1);
      seg[k] = f(seg[k * 2 + 1], seg[k * 2 + 2]);
    }
  }
  T query(int a, int b) {
    T l = unit, r = unit;
    for (a += siz, b += siz; a < b; a >>= 1, b >>= 1) {
      if (!(a & 1)) l = f(l, seg[a++]);
      if (!(b & 1)) r = f(seg[--b], r);
    }
    return f(l, r);
  }
  template <typename C>
  int find(const int start, const int end, int l, int r, int k, const C check,
           T& checknum, const bool b, const function<T(T, T)> revf) {
    if (start <= l && r <= end && !check(seg[k], checknum)) {
      checknum = revf(checknum, seg[k]);
      return -1;
    }
    if ((r <= start || l >= end)) {
      return -1;
    }
    if (k >= siz) {
      return k - siz;
    }
    int res;
    if (b) {
      res = find<C>(start, end, l, ((l + r) >> 1), (k << 1) + 1, check,
                    checknum, b, revf);
      if (res != -1) return (res);
      return find<C>(start, end, ((l + r) >> 1), r, (k << 1) + 2, check,
                     checknum, b, revf);
    } else {
      res = find<C>(start, end, ((l + r) >> 1), r, (k << 1) + 2, check,
                    checknum, b, revf);
      if (res != -1) return (res);
      return find<C>(start, end, l, ((l + r) >> 1), (k << 1) + 1, check,
                     checknum, b, revf);
    }
  }
  template <typename C>
  int find_left(int start, int end, const C check, T checknum,
                function<T(T, T)> revf) {
    return find<C>(start, end, 0, siz + 1, 0, check, checknum, true, revf);
  }
  template <typename C>
  int find_right(int start, int end, const C check, T checknum,
                 function<T(T, T)> revf) {
    return find<C>(start, end, 0, siz + 1, 0, check, checknum, false, revf);
  }
};
int main() {
  int n, s;
  scanf("%d%d", &n, &s);
  vector<int> a(n);
  for (int i = 0; i < (n); ++i) scanf("%d", &a[i]);
  segtree<int> tree(n, 0, plus<int>());
  for (int i = 0; i < (n); ++i) tree.set(i, a[i]);
  Modint ans = 0;
  auto check = [](int a, int b) { return a == b; };
  for (int i = 0; i < (n); ++i) {
    int ok = n - 1, ng = i - 1, mid = i;
    while (ok - ng > 1) {
      mid = (ok + ng) / 2;
      int r = tree.query(i, mid);
      if (r == s) {
        break;
      } else if (r > s) {
        ok = mid;
      } else {
        ng = mid;
      }
    }
    if (tree.query(i, mid) != s)
      continue;
    else
      ans += (i + 1) * (n - mid);
  }
  cout << ans << endl;
  return 0;
}
