#include <bits/stdc++.h>
using namespace std;
long long a[3005];
long long dp[3005][3005];
long long n, s;
long long solve(long long idx, long long sum) {
  if (sum == 0) return n - idx + 1;
  if (sum < 0) return 0;
  if (idx >= n) return 0;
  long long &res = dp[idx][sum];
  if (res != -1) return res;
  res = solve(idx + 1, sum) + solve(idx + 1, sum - a[idx]);
  res %= 1000000007;
  return res;
}
signed main() {
  cin >> n >> s;
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long ans = 0;
  memset(dp, -1, sizeof(dp));
  for (long long i = 0; i < n; i++) ans = (ans + solve(i, s)) % 1000000007;
  cout << ans % 1000000007 << "\n";
}
