#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
int n, k;
long long a[100];
long long dp[101][100001];
long long fun() {
  for (int i = 0; i <= n; ++i) {
    dp[i][0] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; ++j) {
      dp[i][j] = (dp[i][j - 1] + dp[i - 1][j]);
      if (a[i - 1] != j)
        dp[i][j] = (MOD + dp[i][j] - dp[i - 1][k - a[i - 1] - 1]) % MOD;
      else
        dp[i][j] = (dp[i][j]) % MOD;
    }
  }
  return dp[n][k];
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  memset(dp, 0, sizeof(dp));
  cout << fun();
}
