#include <bits/stdc++.h>
using namespace std;
const double PI = 3.1415926535897932;
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;
long long dp[105][100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  dp[0][k] = 1;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j <= k; ++j) {
      int pos = max(0, j - a[i]);
      dp[i + 1][pos] = (dp[i + 1][pos] + dp[i][j]) % mod;
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] - dp[i][j]) % mod;
      while (dp[i + 1][j + 1] < 0) dp[i + 1][j + 1] += mod;
    }
    for (int j = 0; j <= k; ++j) {
      dp[i + 1][j + 1] = (dp[i + 1][j + 1] + dp[i + 1][j]) % mod;
    }
  }
  cout << dp[n][0] << endl;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= k + 1; ++j) {
      cerr << dp[i][j] << " ";
    }
    cerr << "\n";
  }
}
