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