#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  int mod = 1e9 + 7;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int dp[n][k + 1];
  memset(dp, 0, sizeof dp);
  for (int i = 0; i <= arr[n - 1]; i++) dp[n - 1][i] = 1;
  for (int i = n - 2; i >= 0; i--)
    for (int l = 0; l <= k; l++)
      for (int j = 0; j <= arr[i]; j++)
        if (l >= j) dp[i][l] = (dp[i][l] + dp[i + 1][l - j]) % mod;
  cout << dp[0][k];
  return 0;
}
