#include <bits/stdc++.h>
using namespace std;
template <class T>
using vec = vector<T>;
template <class T>
using vvec = vector<vec<T>>;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
const int INF = (long long)1e9;
const long long INFLL = (long long)1e18 + 1;
const long long MOD = (long long)1e9 + 7;
const double PI = acos(-1.0);
struct mint {
  long long x;
  mint(long long _x = 0) : x((_x % MOD + MOD) % MOD) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint modpow(long long t) const {
    if (!t) return 1;
    mint a = modpow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return modpow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
  friend std::ostream& operator<<(std::ostream& os, const mint& a) {
    os << a.x;
    return os;
  }
};
mint dp[3010][3010];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  int N, S;
  cin >> N >> S;
  vector<int> A(N);
  for (int i = 0; i < int(N); ++i) cin >> A[i];
  for (int i = 0; i < int(N); ++i)
    for (int j = 0; j < int(S + 1); ++j) dp[i][j] = 0;
  for (int i = 0; i < int(N); ++i) dp[i][0] = 1;
  for (int i = 0; i < int(N); ++i)
    for (int j = 0; j < int(S + 1); ++j) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][min(S + 1, j + A[i])] += dp[i][j];
    }
  mint ans = 0;
  for (int i = 0; i < int(N + 1); ++i) ans += dp[i][S];
  cout << ans << endl;
}
