#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, k, mod = 1000000007;
  ;
  long long int vect[110];
  static long long int dp[110][10010] = {};
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> vect[i];
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    static long long int sum[10010] = {};
    for (int j = 0; j <= k; j++) {
      sum[j + 1] = (sum[j] + dp[i][j]) % mod;
    }
    for (int j = 0; j <= k; j++) {
      dp[i + 1][j] = (sum[j + 1] - sum[max(0LL, j - vect[i])] + mod) % mod;
    }
  }
  cout << dp[n][k];
  return 0;
}
