#include <bits/stdc++.h>
using namespace std;
long long mult(long long a, long long b, long long p = (long long)(1e9 + 7)) {
  return ((a % p) * (b % p)) % p;
}
long long add(long long a, long long b, long long p = (long long)(1e9 + 7)) {
  return (a % p + b % p) % p;
}
long long fpow(long long n, long long k, long long p = (long long)(1e9 + 7)) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
long long inv(long long a, long long p = (long long)(1e9 + 7)) {
  return fpow(a, p - 2, p);
}
bool sa(const pair<long long, long long> &a,
        const pair<long long, long long> &b) {
  return (a.second < b.second);
}
bool fd(const pair<long long, long long> &a,
        const pair<long long, long long> &b) {
  return (a.first > b.first);
}
bool sd(const pair<long long, long long> &a,
        const pair<long long, long long> &b) {
  return (a.second > b.second);
}
long long dx[4] = {0, 0, 1, -1};
long long dy[4] = {1, -1, 0, 0};
bool valid(long long x, long long y, long long n, long long m) {
  if (x < 0 || y < 0) {
    return false;
  } else if (x >= n || y >= m) {
    return false;
  } else
    return true;
}
long long n, k;
long long a[105];
long long dp[105][100005];
long long func(long long ind, long long choco) {
  if (ind == n - 1) {
    if (choco <= a[n - 1]) {
      return dp[ind][choco] = 1;
    } else {
      return dp[ind][choco] = 0;
    }
  }
  if (dp[ind][choco]) {
    return dp[ind][choco] % (long long)(1e9 + 7);
  }
  for (long long i = 0; i < a[ind] + 1; i++) {
    dp[ind][choco] = add(dp[ind][choco], func(ind + 1, choco - i));
  }
  return dp[ind][choco] % (long long)(1e9 + 7);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long ans;
  cin >> n >> k;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  ans = func(0, k) % (long long)(1e9 + 7);
  cout << ans << "\n";
  return 0;
}
