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