#include <bits/stdc++.h>
using namespace std;
const int MODYYQ = 1e9 + 7;
int n, k, a[105], dp[100][100005];
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int sum = 0;
    for (int j = 0; j <= k; j++) {
      sum += dp[i - 1][j];
      if (j - a[i] - 1 >= 0) sum -= dp[i - 1][j - a[i] - 1];
      sum = (sum % MODYYQ + MODYYQ) % MODYYQ;
      dp[i][j] = sum;
    }
  }
  cout << dp[n][k] << endl;
}
