#include <bits/stdc++.h>
using namespace std;
long long dp[105][100005];
vector<long long> v;
long long func(long long idx, long long candies) {
  if (idx == -1) return !candies;
  long long& ans = dp[idx][candies];
  if (ans != -1) return ans;
  ans = 0;
  for (int i = 0; i <= min(candies, v[idx]); i++)
    ans = (ans + func(idx - 1, candies - i)) % 1000000007;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, k;
  cin >> n >> k;
  v.resize(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  memset(dp, -1, sizeof(dp));
  cout << func(n - 1, k);
  return 0;
}
