#include <bits/stdc++.h>
using namespace std;
const int N = 110, M = 1e5 + 100, mod = 1e9 + 7;
int n, k;
int dp[N][M];
int a[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    dp[i][0] = 1;
    for (int j = 0; j < k; j++) {
      dp[i][j + 1] = (dp[i][j] + dp[i - 1][j + 1]) % mod;
      if (j >= a[i]) dp[i][j + 1] -= dp[i - 1][j - a[i]];
    }
  }
  cout << dp[n][k];
  return 0;
}
