#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; ++i) cin >> a[i];
  long long dp[k + 1][n + 1];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (int i = 0; i <= k; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int r = 0; r <= a[j]; ++r) {
        if (r > i) continue;
        dp[i][j] += dp[i - r][j - 1];
        dp[i][j] %= 1000000007;
      }
    }
  }
  cout << dp[k][n] << '\n';
  return 0;
}
