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