#include <bits/stdc++.h>
using namespace std;
int i, j, k, l, n, m, mini, maxi, res;
int a[11], dp2[10000007], dp1[10000007];
int get(int k) {
  if (k == 0) return 1;
  if (k < 0) return 0;
  return dp1[k];
}
int main() {
  cin >> n >> maxi;
  mini = maxi;
  for (i = 1; i <= n; i++) cin >> a[i];
  memset(dp1, 0, sizeof(dp1));
  res = 0;
  dp1[0] = 1;
  for (i = 1; i <= maxi; i++) dp1[i] = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= maxi; j++) {
      k = (dp1[j] - get(j - min(j, a[i]) - 1)) % 1000000007;
      if (k < 0) k += 1000000007;
      dp2[j] = (k + dp2[j - 1]) % 1000000007;
    }
    for (j = 0; j <= maxi; j++) dp1[j] = dp2[j];
  }
  k = dp1[maxi] - get(mini - 1);
  if (k < 0) k += 1000000007;
  cout << k << endl;
  return 0;
}
