#include <bits/stdc++.h>
using namespace std;
int M = (int)(1e9 + 7);
vector<vector<long long int>> dp(105, vector<long long int>(100005, -1));
vector<int> a(105);
long long int solve(int n, int k) {
  if (k < 0) return (0);
  if (dp[n][k] != -1) return (dp[n][k]);
  if (n == 1) return (dp[n][k] = (k <= a[n]) ? 1 : 0);
  long long int sum = 0;
  for (int i = 0; i <= a[n]; i++) sum = (sum + solve(n - 1, k - i)) % M;
  return (dp[n][k] = sum);
}
int main() {
  int n, k;
  long long int ans;
  cin >> n >> k;
  a.push_back(-1);
  for (int i = 1; i <= n; i++) cin >> a[i];
  ans = solve(n, k);
  cout << ans << endl;
  return (0);
}
