#include <bits/stdc++.h>
using namespace std;
const int N = 105, K = 100005, M = 1e9 + 7;
int n, k, a[N];
long long dp[N][K];
bool solved[N][K];
long long calc(int i, int j) {
  if (i == n) {
    if (!j) {
      return 1;
    } else {
      return 0;
    }
  }
  if (solved[i][j]) {
    return dp[i][j];
  }
  for (int k = 0; k <= a[i]; k++) {
    if (j >= k) {
      dp[i][j] += calc(i + 1, j - k);
      dp[i][j] %= M;
    }
  }
  solved[i][j] = 1;
  return dp[i][j];
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << calc(0, k);
}
