#include <bits/stdc++.h>
#define FOR(i, a, n) for(int (i) = (int)(a); (i) < (int)(n); ++(i))
#define FORe(i, a, n) for(int (i) = (int)(a); (i) <= (int)(n); ++(i))
#define rFOR(i, a, n) for(int (i) = (int)(n)-1; (i) >= (int)(a); --(i))
#define REP(i, n) FOR((i), 0, (n))
#define REPe(i, n) FORe((i), 0, (n))
#define rREP(i, n) rFOR((i), 0, (n))
#define rep(i, n) FOR((i), 0, (n))
#define all(v) (v).begin(), (v).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
  int n, s;
  cin >> n >> s;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  vector<mint> q(s+1);
  mint ans = 0;
  REP(i, n) {
    q[0] += 1;

    vector<mint> q2(s+1);
    REP(j, s+1) {
      q2[j] += q[j];
      if (j+a[i] <= s) q2[j+a[i]] += q[j];
    }
    q = q2;

    ans += q[s];
  }

  return 0;
}