#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60;
const int MOD = 1e9 + 7;
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 main() {
  int N, K;
  cin >> N >> K;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  vector<vector<int>> dp(N + 1, vector<int>(K + 1, 0));
  dp[0][0] = 1;
  for (int i = 0; i < N; i++)
    for (int j = 0; j < K + 1; j++)
      for (int k = 0; k < min(a[i], K - j) + 1; k++) {
        dp[i + 1][j + k] += dp[i][j] % MOD;
        dp[i + 1][j + k] %= MOD;
      }
  cout << dp[N][K] << endl;
}
