#include <bits/stdc++.h>
using namespace std;
long long dp[100005][103];
int n, k;
int a[103];
int p[103];
long long recur(int k1, int l) {
  if (l == n && k1 == 0)
    return 1LL;
  else if (l == n && k1 != 0)
    return 0;
  else if (dp[k1][l] != -1)
    return dp[k1][l];
  else {
    if (k1 > p[l]) {
      dp[k1][l] = 0;
      return 0;
    }
    dp[k1][l] = 0;
    for (int j = 0; j <= min(a[l], k1); j++)
      dp[k1][l] = (dp[k1][l] + recur(k1 - j, l + 1)) % 1000000007;
    return dp[k1][l];
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  p[n - 1] = a[n - 1];
  for (int i = n - 2; i >= 0; i--) p[i] = p[i + 1] + a[i];
  for (int i = 0; i < 100005; i++) {
    for (int j = 0; j < 103; j++) dp[i][j] = -1;
  }
  cout << recur(k, 0);
}
