#include <bits/stdc++.h>
using namespace std;
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const bool b) { return (b ? "true" : "false"); }
string to_string(const char* s) { return to_string((string)s); }
string to_string(const char c) {
  string s = "'";
  s += c;
  s += "'";
  return s;
}
template <class T, class U>
string to_string(const pair<T, U>& p) {
  string s = "(";
  s += to_string(p.first);
  s += ", ";
  s += to_string(p.second);
  s += ")";
  return s;
}
template <class T>
string to_string(const T& a) {
  bool first = true;
  string s = "{";
  for (const auto& x : a) {
    if (!first) {
      s += ", ";
    }
    first = false;
    s += to_string(x);
  }
  s += "}";
  return s;
}
void debug_out() { cerr << '\n'; }
template <class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
  cerr << ' ' << to_string(head);
  debug_out(tail...);
}
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  int n;
  int s;
  cin >> n >> s;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<int> dp(s + 1);
  ll answer = 0;
  for (int i = 0; i < n; ++i) {
    ++dp[0];
    for (int ss = s; ss >= 0; --ss) {
      if (ss + a[i] <= s) {
        dp[ss + a[i]] += dp[ss];
      }
    }
    answer += dp[s];
    answer %= mod;
  }
  cout << answer << '\n';
  return 0;
}
