#include <bits/stdc++.h>
using namespace std;
int mod = (int)1e9 + 7;
int ways(int arr[], vector<vector<int>> &dp, int n, int k) {
  if (k < 0) return 0;
  if (n == 0 && k == 0) return 1;
  if (n == 0 && k > 0) return 0;
  if (dp[n][k] != -1) return dp[n][k];
  int ans = 0;
  for (int i = 0; i <= arr[n - 1]; i++) {
    ans = (ans % mod + ways(arr, dp, n - 1, k - i) % mod) % mod;
  }
  dp[n][k] = ans;
  return ans;
}
int main() {
  int n, k;
  cin >> n >> k;
  vector<vector<int>> dp(n + 1, vector<int>(k + 1, -1));
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << ways(arr, dp, n, k) << endl;
  return 0;
}
