#include <bits/stdc++.h>
using namespace std;
vector<int> arr(101, -1);
int N, K;
long long dp[101][100001];
long long mod = 1e9 + 7;
long long getWays(int index, int c) {
  if (c < 0) {
    return -1;
  }
  if (index == N) {
    return c == 0 ? 1 : -1;
  }
  if (dp[index][c] != -1) return dp[index][c];
  long long temp, result = 0;
  bool allowed = false;
  for (int i = 0; i <= arr[index]; ++i) {
    temp = getWays(index + 1, c - i);
    if (temp != -1) {
      result += (temp % mod);
      allowed = true;
    }
  }
  return dp[index][c] = (allowed ? result : -1);
}
int main() {
  cin >> N >> K;
  for (int i = 0; i < N; ++i) {
    cin >> arr[i];
  }
  for (int i = 0; i < N; ++i) {
    for (int j = 0; j < K + 1; ++j) {
      dp[i][j] = -1;
    }
  }
  long long result = getWays(0, K);
  cout << (result == -1 ? 0 : result % mod) << endl;
  return 0;
}
