#include <bits/stdc++.h>
using namespace std;
const int mx = 105;
const int mod = 1e9 + 7;
long long dp[mx][100005];
long long cnt = 0;
long long a[mx];
int n, k;
long long rec(int index, int k) {
  if (index == n && k == 0) {
    return 1;
  }
  if (index == n) return 0;
  if (dp[index][k] != -1) return dp[index][k];
  long long res = 0;
  for (int i = 0; i <= a[index]; i++) {
    res = (res + rec(index + 1, k - i)) % mod;
  }
  res = res % mod;
  dp[index][k] = res;
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = -1;
    }
  }
  cout << rec(0, k) << '\n';
  return 0;
}
