#include <bits/stdc++.h>
using namespace std;
long long N, K;
long long call(long long i, long long j, vector<long long>& A,
               vector<vector<long long> >& dp) {
  if (i == N) {
    if (j == 0) {
      return 1;
    }
    return 0;
  }
  if (dp[i][j] != -1) return dp[i][j];
  long long cnt = 0;
  for (long long k = 0; k <= min(j, A[i]); k++) {
    cnt += call(i + 1, j - k, A, dp);
    cnt = cnt % 1000000007;
  }
  return dp[i][j] = cnt;
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N >> K;
  vector<long long> A(N);
  for (long long i = 0; i < N; i++) {
    cin >> A[i];
  }
  vector<vector<long long> > dp(N, vector<long long>(K + 1, -1));
  cout << call(0, K, A, dp);
  return 0;
}
