#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000 * 1000 * 1000 + 7;
const long long MOD2 = 998244353;
const long long N = 1000 * 1000 + 5;
const double PI = 3.14159265;
long long search(vector<long long> arr, long long l, long long r, long long x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return search(arr, l, mid - 1, x);
    return search(arr, mid + 1, r, x);
  }
  return -1;
}
long long gcd(long long a, long long b) {
  if (!b) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
long long power(long long x, long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long n, long long p) { return power(n, p - 2, p); }
const int maxn = 3e5 + 5;
int n;
long long dp[maxn][105];
long long a[105], k;
long long solve(int candies, int lvl) {
  if (candies == 0 && lvl == n) return 1;
  if (lvl > n) return 0;
  if (dp[candies][lvl] != -1) return dp[candies][lvl];
  long long ans = 0;
  for (int i = 0; i < a[lvl] + 1; i++) {
    if (i > candies) break;
    ans = (ans + solve(candies - i, lvl + 1)) % MOD;
  }
  return dp[candies][lvl] = ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(k, 0) << "\n";
}
