#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long prefix[101][100001], dp[101][100001];
long long arr[101];
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i <= k; ++i) {
    prefix[0][i] = 1;
  }
  for (int i = 0; i <= n; ++i) {
    prefix[i][0] = 1;
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= k; j++) {
      if (j - arr[i] - 1 >= 0)
        dp[i][j] =
            (dp[i][j] + (prefix[i - 1][j] - prefix[i - 1][j - arr[i] - 1])) %
            mod;
      else
        dp[i][j] = (dp[i][j] + prefix[i - 1][j]) % mod;
      prefix[i][j] = (prefix[i][j - 1] + dp[i][j]) % mod;
    }
  }
  cout << (dp[n][k] + mod) % mod;
  return 0;
}
