#include <bits/stdc++.h>
using namespace std;
int dp[103][100003], n, k, a[103], mod = 1000000007;
int main() {
  cin >> n >> k;
  dp[0][k] = 1;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = k; j >= k - a[i]; j--) {
      cnt = (dp[i - 1][j] + cnt) % mod;
      dp[i][j] = cnt;
    }
    for (int j = k - a[i] - 1; j >= 0; j--) {
      cnt = ((cnt - dp[i - 1][j] + dp[i - 1][j + a[i] + 1]) % mod + mod) % mod;
      dp[i][j] = cnt;
    }
  }
  cout << dp[n][0];
}
