#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
long long int helper(int k, int* arr, int n, int st, vector<vector<int>>& dp) {
  if (k < 0) return 0;
  if (k == 0) {
    return 1;
  }
  if (st == n) return 0;
  if (dp[k][st] != -1) {
    return dp[k][st];
  }
  long long int an = 0;
  for (int j = 0; j <= arr[st]; j++) {
    an = (an + helper(k - j, arr, n, st + 1, dp)) % (mod);
  }
  dp[k][st] = an;
  return an;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<vector<int>> dp(k + 1, vector<int>(n, -1));
  long long int val = helper(k, arr, n, 0, dp);
  cout << val;
}
