#include <bits/stdc++.h>
using namespace std;
template <class A, class B>
ostream &operator<<(ostream &out, const pair<A, B> &a) {
  return out << "(" << a.first << "," << a.second << ")";
}
template <class A>
ostream &operator<<(ostream &out, const vector<A> &a) {
  for (const A &it : a) out << it << " ";
  return out;
}
template <class A, class B>
istream &operator>>(istream &in, pair<A, B> &a) {
  return in >> a.first >> a.second;
}
template <class A>
istream &operator>>(istream &in, vector<A> &a) {
  for (A &i : a) in >> i;
  return in;
}
long long n, k;
long long dp[100][100001];
long long v[100];
long long f(long long i, long long sum) {
  if (sum > k) return 0;
  if (i == n) return sum == k;
  long long &ans = dp[i][sum];
  if (ans != -1) return ans;
  ans = 0;
  for (long long j = 0; j <= v[i]; j++) {
    ans += f(i + 1, sum + j);
    if (ans >= (1000000007)) ans -= (1000000007);
  }
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(dp, -1, sizeof dp);
  cin >> n >> k;
  for (long long i = 0; i < n; i++) cin >> v[i];
  cout << f(0, 0);
}
