#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vs = vector<string>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1 << 30) - 1;
const ll INFLL = (1LL << 62) - 1;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
template <typename T>
inline ll suma(const vector<T>& a) {
  ll res(0);
  for (auto&& x : a) res += x;
  return res;
}
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;
}
int dp[105][110000];
int main() {
  int N, K;
  cin >> N >> K;
  vi a(N);
  for (int i = (0); i < (N); ++i) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j <= K; ++j) {
      for (int k = 0; k <= a[i]; ++k) {
        if (j - k >= 0) dp[i + 1][j] = (dp[i + 1][j] + dp[i][j - k]) % mod;
      }
    }
  }
  cout << dp[N][K] << endl;
  return 0;
}
