#include <bits/stdc++.h>
using namespace std;
template <typename X>
ostream& operator<<(ostream& x, const vector<X>& v) {
  for (long long i = 0; i < v.size(); ++i) x << v[i] << " ";
  return x;
}
template <typename X>
ostream& operator<<(ostream& x, const set<X>& v) {
  for (auto it : v) x << it << " ";
  return x;
}
template <typename X, typename Y>
ostream& operator<<(ostream& x, const pair<X, Y>& v) {
  x << v.ff << " " << v.ss;
  return x;
}
template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v) {
  for (auto it : v) os << it.first << "=>" << it.second << endl;
  return os;
}
struct pair_hash {
  inline std::size_t operator()(
      const std::pair<long long, long long>& v) const {
    return v.first * 31 + v.second;
  }
};
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
const int N = 3003;
long long dp[N][N][3];
int n;
long long a[N];
long long ans;
long long f(int i, int j, int k) {
  if (j < 0) {
    return 0;
  }
  if (j == 0) {
    return n - i + 1;
  }
  if (i == n) {
    if (j != 0) {
      return 0;
    }
  }
  if (dp[i][j][k] != -1) {
    return dp[i][j][k];
  }
  if (k == 1) {
    dp[i][j][k] = 0;
    dp[i][j][k] += f(i + 1, j - a[i], 2);
  } else {
    dp[i][j][k] = 0;
    dp[i][j][k] += f(i + 1, j - a[i], 2) + f(i + 1, j, 2);
  }
  dp[i][j][k] %= 1000000007LL;
  return dp[i][j][k];
}
int main() {
  memset(dp, -1, sizeof dp);
  long long s;
  cin >> n >> s;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  };
  ans = 0;
  for (long long i = 0; i < n; i++) {
    ans += f(i, s, 1) * (i + 1);
    ans %= 1000000007LL;
  }
  cout << ans << endl;
}
