#include <bits/stdc++.h>
using namespace std;
int f[100010], n, k, a[110], sum[110], mode = 1000000007, sum1[100010];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  f[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) sum1[j] = (sum1[j - 1] + f[j]) % mode;
    for (int j = 0; j <= min(sum[i], k); j++)
      f[j] = (sum1[min(j, sum[i - 1])] - sum1[max(0, j - a[i]) - 1]) % mode;
  }
  cout << f[k] % mode << endl;
  return 0;
}
