#include <bits/stdc++.h>
using namespace std;
inline long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
inline long long power(long long a, long long n, long long m) {
  if (n == 0) return 1;
  long long p = power(a, n / 2, m);
  p = (p * p) % m;
  if (n % 2)
    return (p * a) % m;
  else
    return p;
}
const long long MOD = 1e9 + 7;
const int N = int(3e5) + 999;
long long int n, k;
vector<long long int> arr;
long long int dp[100005][105];
long long int solve(long long int node, long long int left) {
  if (left < 0)
    return 0;
  else if (node == n and left == 0)
    return 1;
  else if (node == n and left != 0)
    return 0;
  if (dp[left][node] != -1) return dp[left][node];
  dp[left][node] = 0;
  for (long long int c = 0; c <= arr[node] and c <= left; c++)
    dp[left][node] = (dp[left][node] + solve(node + 1, left - c)) % MOD;
  return dp[left][node];
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  cin >> n >> k;
  arr.resize(n);
  memset(dp, -1, sizeof dp);
  for (long long int i = 0; i < n; i++) cin >> arr[i];
  solve(0, k);
  long long int x = 0;
  for (long long int i = 0; i < 100005; i++)
    if (dp[i][0] != -1) x += dp[i][0];
  cout << x;
  return 0;
}
