#include <bits/stdc++.h>
using namespace std;
int dp[101][100001];
int main() {
  int n, k;
  cin >> n >> k;
  int a[n + 1];
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 1; i <= k; i++) dp[0][i] = 0;
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (a[i] >= j)
        dp[i][j] = (dp[i - 1][j] % 1000000007 + dp[i][j - 1] % 1000000007) %
                   1000000007;
      else
        dp[i][j] = (dp[i][j - 1] % 1000000007 -
                    dp[i][j - 1 - a[i]] % 1000000007 + 1000000007) %
                               1000000007 >=
                           0
                       ? (dp[i][j - 1] % 1000000007 -
                          dp[i][j - 1 - a[i]] % 1000000007 + 1000000007) %
                             1000000007
                       : 0;
    }
  }
  cout << dp[n][k] % 1000000007;
  return 0;
}
