#include <bits/stdc++.h>
using namespace std;
long long int power(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = (res * a);
      b--;
    }
    a = (a * a);
    b >>= 1;
  }
  return res;
}
long long int n;
long long int gcd(long long int a, long long int b) {
  return (b == 0) ? a : gcd(b, a % b);
}
vector<vector<long long int> > dp(101, vector<long long int>(100005, 0));
vector<long long int> v;
void solve(long long int k) {
  for (long long int i = 0; i <= v[0]; i++) {
    dp[0][i]++;
  }
  for (long long int i = 1; i < n; i++) {
    for (long long int j = 0; j <= k; j++) {
      for (long long int m = 0; m <= v[i]; m++) {
        if (m > j) break;
        dp[i][j] = (dp[i][j] + dp[i - 1][j - m]) % 1000000007;
      }
    }
  }
}
int main() {
  long long int kk;
  cin >> n >> kk;
  for (long long int i = 0; i < n; i++) {
    long long int dd;
    cin >> dd;
    v.push_back(dd);
  }
  solve(kk);
  cout << dp[n - 1][kk] << "\n";
}
