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