#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
  return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  return (b < a) ? (a = b, 1) : 0;
}
ll dp[101][100001];
int a[100];
ll dfs(int i, int j) {
  if (dp[i][j] != -1) return dp[i][j];
  ll ret = 0;
  for (int k = 0; k <= a[i - 1]; ++k) {
    if (j - k < 0) continue;
    ret = (ret + dfs(i - 1, j - k)) % MOD;
  }
  return dp[i][j] = ret;
}
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int j = 0; j <= k; ++j) {
    dp[n][k] = -1;
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= k; ++j) {
      dp[i][j] = -1;
    }
  }
  cout << dfs(n, k) << endl;
  return 0;
}
