#include <bits/stdc++.h>
using namespace std;
int dp[105][100005];
int mod = 1e9 + 7;
vector<int> arr;
int n, k;
void dfs(int left, int k) {
  if (k < 0 || left < 0) {
    return;
  }
  if (dp[left][k] > 0) {
    return;
  }
  if (left == 0 && k == 0) {
    dp[left][k] = 1;
    return;
  }
  for (int i = arr[left - 1]; i >= 0; --i) {
    if (k - i >= 0 && left - 1 >= 0) {
      dfs(left - 1, k - i);
      dp[left][k] += dp[left - 1][k - i];
      dp[left][k] %= mod;
    }
  }
  return;
}
int main() {
  cin >> n >> k;
  arr = vector<int>(n);
  for (int i = 0; i < n; ++i) cin >> arr[i];
  dfs(n, k);
  cout << dp[n][k] << endl;
  return 0;
}
