#include <bits/stdc++.h>
using namespace std;
long long dp[101][100001];
long long arr[101];
long long solvedp(long long index, long long candies, long long n) {
  if (index != n && candies < 0) {
    return 0;
  }
  if (index == n) {
    if (candies < 0 || candies > 0) {
      return 0;
    } else {
      return 1;
    }
  }
  if (dp[index][candies] != -1) {
    return dp[index][candies];
  }
  long long ans = 0;
  for (long long i = 0; i <= arr[index]; i++) {
    if (i > candies) {
      break;
    }
    ans = (ans + solvedp(index + 1, candies - i, n)) % 1000000007;
  }
  dp[index][candies] = ans;
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  long long k;
  cin >> k;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << solvedp(0, k, n);
  return 0;
}
