#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[105];
int dp[105][100005];
int f[100005];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 1; i <= a[1]; i++) {
    dp[1][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1;
  }
  long long sum = 0;
  for (int i = 2; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      sum += dp[i - 1][j];
      f[j] = sum;
      if (j >= a[i])
        dp[i][j] = sum - f[j - a[i] - 1];
      else
        dp[i][j] = sum;
      dp[i][j] %= 1000000007;
      sum %= 1000000007;
    }
    sum = 0;
  }
  cout << dp[n][k];
}
