#include <bits/stdc++.h>
using namespace std;
long long int result[101][100001] = {};
long long int resultsum[101][100001] = {};
int main() {
  int n, k;
  cin >> n >> k;
  int a[101];
  int suma[101] = {};
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    suma[i] = suma[i - 1] + a[i];
  }
  result[0][0] = 1;
  resultsum[0][0] = 1;
  for (int j = 1; j <= a[1]; j++) {
    resultsum[0][j] = resultsum[0][j - 1];
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= suma[i]; j++) {
      result[i][j] = resultsum[i - 1][j];
      if (j - a[i] - 1 >= 0)
        result[i][j] =
            (result[i][j] - resultsum[i - 1][j - a[i] - 1] + 1000000007) %
            1000000007;
    }
    if (i == n) continue;
    resultsum[i][0] = result[i][0];
    for (int j = 1; j <= suma[i + 1]; j++) {
      resultsum[i][j] = (resultsum[i][j - 1] + result[i][j]) % 1000000007;
    }
  }
  cout << result[n][k] << endl;
  return 0;
}
