#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int nax = 101;
const int kax = 1e5 + 1;
const int aax = kax;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for (int &i : a) cin >> i;
  vector<int> dp(k + 1);
  dp[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = k; j >= 0; j--) {
      for (int l = 1; l <= min(a[i], k - j); l++) {
        dp[j + l] = (dp[j + l] + dp[j]) % mod;
      }
    }
  }
  cout << dp[k] % mod << endl;
  return 0;
}
