#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll 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 pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};
mint fact(int n) {
  if (n == 1 || n == 0) return 1;
  mint res = n;
  return res * fact(n - 1);
}
int main() {
  ll n, s;
  cin >> n >> s;
  vl a(n);
  for (int i = 0, i_len = (n); i < i_len; ++i) cin >> a[i];
  vector<vector<mint>> dp(n + 1, vector<mint>(s + 3010, 0));
  for (int i = 0, i_len = (n + 1); i < i_len; ++i) dp[i][0] = 1;
  for (int i = 0, i_len = (n); i < i_len; ++i)
    for (int j = 0, j_len = (s + 1); j < j_len; ++j) {
      dp[i + 1][j] += dp[i][j];
      dp[i + 1][j + a[i]] += dp[i][j];
    }
  mint ans = 0;
  for (int i = 0, i_len = (n + 1); i < i_len; ++i) ans += dp[i][s];
  cout << ans.x << endl;
}
