#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int N = (int)3e5 + 123;
const long long inf = (long long)1e18 + 1;
const double pi = acos(-1.0);
const double eps = 1e-9;
const int dx[] = {0, 0, 1, 0, -1};
const int dy[] = {0, 1, 0, -1, 0};
int n, s, a[3003], dp[3003][3003], ans;
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
inline void boost() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
}
inline void Solve() {
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= s; j++) {
      dp[i][j] = add(dp[i][j], dp[i - 1][j] + (j == 0));
      if (j >= a[i]) dp[i][j] = add(dp[i][j], dp[i - 1][j - a[i]]);
    }
    ans = add(ans, dp[i][s]);
  }
  cout << ans;
}
signed main() {
  boost();
  int tt = 1;
  while (tt--) {
    Solve();
  }
  return 0;
}
