#include <bits/stdc++.h>
using namespace std;
const long long inf = 2e18;
const long long ninf = -2e18 - 5;
const long long mod = 1e9 + 7;
long long n, k, cnt;
long long arr[101];
long long dp[101][100010];
long long pre[101][100010];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j <= k; j++) {
      dp[i][j] = -1;
    }
  }
  for (long long i = n - 1; i >= 0; --i) {
    long long now = 0;
    for (long long j = 0; j <= k; j++) {
      if (i == n - 1) {
        if (j <= arr[i])
          dp[i][j] = 1;
        else
          dp[i][j] = 0;
      } else {
        long long l = min(arr[i], j);
        dp[i][j] = (pre[i + 1][j] - pre[i + 1][j - l] + dp[i + 1][j - l]) % mod;
      }
      now = (now + dp[i][j]) % mod;
      pre[i][j] += now;
    }
  }
  cout << dp[0][k] << "\n";
  return 0;
}
