#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cout << *it << " = " << a << endl;
  err(++it, args...);
}
const int mod = 1e9 + 7;
const int MAX = 1e5 + 5;
long long dp[101][MAX];
void add_self(long long &a, long long b) {
  a = (a + b) % mod;
  a %= mod;
}
void sub_self(long long &a, long long b) {
  a = (a - b) % mod;
  a %= mod;
}
void solve() {
  int n, k;
  cin >> n >> k;
  int arr[n + 1];
  for (int i = 1; i <= n; i++) cin >> arr[i];
  dp[0][k] = 1;
  for (int i = 0; i < n; i++) {
    vector<long long> fake(k + 1, 0);
    for (int j = 0; j <= k; j++) {
      add_self(fake[j], dp[i][j]);
      if (j - (arr[i + 1] + 1) >= 0)
        sub_self(fake[j - (arr[i + 1] + 1)], dp[i][j]);
    }
    long long prefix = 0;
    for (int j = k; j >= 0; j--) {
      add_self(prefix, fake[j]);
      add_self(dp[i + 1][j], prefix);
    }
  }
  cout << dp[n][0];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  solve();
}
