#include <bits/stdc++.h>
using namespace std;
int mod = pow(10, 9) + 7;
int main() {
  long long int N, K;
  cin >> N >> K;
  vector<long long int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  vector<vector<long long int>> dp(N + 1, vector<long long int>(K + 1, 0));
  for (long long int i = 0; i <= N; i++) {
    dp[i][0] = 1;
  }
  long long sum = 0;
  for (long long int i = 1; i <= N; i++) {
    sum += a[i - 1];
    for (long long int k = 1; k <= min(K, sum); k++) {
      for (long long int j = 0; j <= a[i - 1]; j++) {
        if (k < j) break;
        dp[i][k] = (dp[i][k] + dp[i - 1][k - j]) % mod;
      }
    }
  }
  cout << dp[N][K];
  return 0;
}
