#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[101][100001] = {0};
long long func(int k, int* a) {
  for (int i = 0; i <= a[n]; i++) dp[n][i] = 1;
  for (int i = n - 1; i >= 1; i--) {
    for (int c = 0; c <= k; c++) {
      for (int j = 0; j <= a[i]; j++) {
        if (c - j >= 0) {
          if (dp[i + 1][c - j] == 0) break;
          dp[i][c] += dp[i + 1][c - j];
        } else
          break;
      }
    }
  }
  return dp[1][k];
}
int main() {
  cin >> n;
  int k;
  cin >> k;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  cout << func(k, a) % 1000000007;
}
