#include <bits/stdc++.h>
long long MOD = 1e9 + 7;
using namespace std;
long long int dp[101][100001];
int main() {
  int n, i, k, j, s = 0;
  cin >> n >> k;
  int coins[n];
  for (i = 0; i < n; i++) {
    cin >> coins[i];
    s += coins[i];
  }
  for (i = 1; i <= k; i++) dp[0][i] = 0;
  dp[0][0] = 1;
  int rem = s - k;
  if (rem < 0)
    cout << 0;
  else if (rem == 0)
    cout << 1;
  else {
    int sum[k + 1];
    for (i = 1; i <= n; i++) {
      dp[i][0] = 0;
      sum[0] = 1;
      for (j = 1; j <= k; j++) sum[j] = (sum[j - 1] + dp[i - 1][j]) % MOD;
      for (j = 1; j <= k; j++) {
        int temp = j - coins[i - 1];
        int sub;
        if (temp <= 0) {
          sub = 0;
        } else
          sub = sum[temp - 1];
        dp[i][j] = (sum[j] - sub) % MOD;
      }
    }
    cout << dp[n][k];
  }
}
