#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
long long a[3005], dp[3005][3005];
int main() {
  int n, s;
  cin >> n >> s;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long ans = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0]++;
    for (int j = 0; j <= 3000; j++)
      dp[i + 1][j] = (dp[i + 1][j] + dp[i][j]) % mod;
    for (int j = 0; j <= 3000; j++) {
      if (j + a[i] > 3000) continue;
      dp[i + 1][j + a[i]] = (dp[i + 1][j + a[i]] + dp[i][j]) % mod;
    }
  }
  for (int i = 1; i <= n + 1; i++) {
    ans += dp[i][s];
    ans %= mod;
  }
  cout << ans << endl;
}
