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