#include <bits/stdc++.h>
using namespace std;
long long possible_distribution(vector<long long>& capacity,
                                vector<long long> sol, long long k, long long n,
                                vector<vector<long long>>& dp) {
  if (k == 0) {
    return 1;
  }
  if (k < 0 || n < 0) {
    return 0;
  }
  if (dp[n][k] != -1) {
    return dp[n][k];
  }
  long long ans = 0;
  for (long long j = 0; j <= capacity[n]; j++) {
    sol[n] = j;
    ans = ((ans % 1000000007) +
           (possible_distribution(capacity, sol, k - j, n - 1, dp) %
            1000000007)) %
          1000000007;
  }
  return dp[n][k] = ans % 1000000007;
}
int main() {
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  vector<long long> capacity(n);
  for (long long i = 0; i < n; i++) {
    long long d;
    cin >> d;
    capacity[i] = d;
  }
  vector<long long> sol(n);
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, -1));
  cout << possible_distribution(capacity, sol, k, n - 1, dp) << endl;
  return 0;
}
