#include <bits/stdc++.h>
using namespace std;
long long dp[200010];
int main() {
  int N, S, A[200010];
  cin >> N >> S;
  for (int i = 0; i < N; i++) cin >> A[i];
  long long ans = 0;
  for (int i = 0; i < N; i++) {
    dp[0]++;
    for (int j = S - A[i]; j >= 0; j--) {
      dp[j + A[i]] = (dp[j + A[i]] + dp[j]) % 1000000007;
    }
    ans += dp[S];
  }
  cout << ans % 1000000007 << endl;
  return 0;
}
