#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  os << '{';
  string sep = "";
  for (const auto &x : v) os << sep << x, sep = ", ";
  return os << '}';
}
template <typename A, typename B>
ostream &operator<<(ostream &os, const pair<A, B> &p) {
  return os << '(' << p.first << ", " << p.second << ')';
}
void dbg_out() { cerr << "\n"; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
const int mod = 1e9 + 7;
const int N = 1e5 + 5;
long long arr[105];
int n, k;
long long dp[105][N];
int dfs(int i, int sum) {
  if (i == n) return sum == 0 ? 1 : 0;
  if (dp[i][sum] != -1) return dp[i][sum];
  long long res = 0;
  int mx = min((int)sum, (int)arr[i]);
  for (int x = 0; x <= mx; ++x) {
    res = (res + dfs(i + 1, sum - x)) % mod;
  }
  return dp[i][sum] = res;
}
void solve() {
  int k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) cin >> arr[i];
  memset(dp, -1, sizeof dp);
  cout << dfs(0, k) << "\n";
}
int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  solve();
  return 0;
}
