#include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<int> dx{1, -1, 0, 0};
vector<int> dy{0, 0, 1, -1};
int a, b, c;
int savinga, savingb, savingc;
vector<vector<bool>> matrix;
void preProcessing() {
  matrix.resize(3e4 + 3);
  for (int i = 0; i < 3e4 + 3; i++) {
    matrix[i].resize(3e4 + 3, false);
  }
  for (int i = 1; i <= 3e4; i++) {
    for (int j = 1; j * j <= i; j++) {
      if ((i % j) == 0) {
        matrix[i][j] = true;
        matrix[i][i / j] = true;
      }
    }
  }
}
bool isPossible(int a1, int b1, int c1) {
  if (!((a1 <= b1) && (b1 <= c1))) return false;
  if (a1 <= 3e4 && b1 <= 3e4 && c1 <= 3e4) {
    if (matrix[c1][b1] && matrix[b1][a1]) return true;
    return false;
  }
}
bool check(int op) {
  for (int i = 0; i <= op; i++) {
    for (int j = 0; j <= (op - i); j++) {
      for (int k = op - i - j; k <= op - i - j; k++) {
        for (int s1 = -1; s1 <= 1; s1++) {
          for (int s2 = -1; s2 <= 1; s2++) {
            for (int s3 = -1; s3 <= 1; s3++) {
              int na = a + s1 * i;
              int nb = b + s2 * j;
              int nc = c + s3 * k;
              if (na <= 0) continue;
              if (nb <= 0) continue;
              if (nc <= 0) continue;
              if (isPossible(na, nb, nc)) {
                savinga = na;
                savingb = nb;
                savingc = nc;
                return true;
              }
            }
          }
        }
      }
    }
  }
  return false;
}
vector<vector<int>> dp;
int n, k;
int mod = 1e9 + 7;
int solve(int i, int money) {
  if (i == n) {
    if (money == 0)
      return 1;
    else
      return 0;
  }
  if (money == 0) return 1;
  if (dp[i][money] != -1) return dp[i][money];
  int ret = 0;
  for (int m = 0; m <= min(money, v[i]); m++) {
    ret += solve(i + 1, money - m);
    if (ret > mod) ret %= mod;
  }
  if (ret > mod) ret %= mod;
  dp[i][money] = ret;
  return ret;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> k;
  dp.resize(n);
  for (int i = 0; i < n; i++) {
    dp[i].resize(k + 1, -1);
  }
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cout << solve(0, k) << endl;
  return 0;
}
