#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void ZZ(const char* name, Arg1&& arg1) {
  std::cerr << name << " = " << arg1 << "\n";
}
template <typename Arg1, typename... Args>
void ZZ(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " = " << arg1;
  ZZ(comma, args...);
}
const long long int INF = 1e18 + 7;
const long long int MAX = 3001;
const long long int MOD = 1000000007;
long long int n, s;
long long int A[MAX], dp[MAX][MAX];
long long int sets(long long int r, long long int sum) {
  if (!sum) return (n - r + 1);
  if (r == n) return 0;
  if (dp[r][sum] != -1) return dp[r][sum];
  long long int ans = 0;
  ans = sets(r + 1, sum);
  if (sum >= A[r]) {
    ans += sets(r + 1, sum - A[r]);
    ans %= MOD;
  }
  return dp[r][sum] = ans;
}
void solve() {
  memset(dp, -1, sizeof dp);
  cin >> n >> s;
  for (long long int i = 0; i < n; i++) cin >> A[i];
  long long int ans = 0;
  for (long long int r = 0; r < n; r++) ans += sets(r, s), ans %= MOD;
  cout << ans;
}
int32_t main() {
  long long int t;
  t = 1;
  cin.sync_with_stdio(0), cin.tie(0);
  while (t--) {
    solve();
    cout << "\n";
    ;
  }
  return 0;
}
