#include <bits/stdc++.h>
using namespace std;
const long long INF = 4 * 1e18;
const long long MOD = 1000000007;
const long double EPS = 1e-10;
const long double PI = 3.141592653589793;
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const pair<long long, long long> fd[] = {make_pair(1, 0), make_pair(-1, 0),
                                         make_pair(0, 1), make_pair(0, -1)};
long long n, s, a[3100], dp[3100][3100], ans[3100][3100];
signed main() {
  cin >> n >> s;
  for (long long i = (0); i < (n); i++) cin >> a[i + 1];
  for (long long i = (0); i < (3100); i++)
    for (long long j = (0); j < (3100); j++) dp[i][j] = ans[i][j] = 0;
  dp[0][0] = 1;
  for (long long i = (0); i < (n + 1); i++) dp[i][0] = i + 1;
  for (long long i = (1); i < (n + 1); i++) {
    for (long long j = (0); j < (s + 10); j++) {
      if (j - a[i] >= 0) dp[i][j] = (dp[i - 1][j] + dp[i - 1][j - a[i]]) % MOD;
    }
  }
  ans[1][a[1]] = 1;
  for (long long i = (0); i < (n + 1); i++) ans[i][0] = i + 1;
  for (long long i = (2); i < (n + 1); i++) {
    for (long long j = (1); j < (s + 10); j++) {
      if (j - a[i] >= 0)
        ans[i][j] =
            ((ans[i - 1][j] + dp[i - 1][j]) % MOD + dp[i - 1][j - a[i]]) % MOD;
    }
  }
  cout << ans[n][s] << endl;
}
