#include <bits/stdc++.h>
using namespace std;
int dp[101][100001];
int util(int arr[], int n, int k, int i) {
  if (i == n and k == 0)
    return 1;
  else if (k < 0 or i == n)
    return 0;
  if (dp[i][k] != -1) return dp[i][k];
  dp[i][k] = (1000000007 + util(arr, n, k, i + 1) + util(arr, n, k - 1, i) -
              util(arr, n, k - 1 - arr[i], i + 1)) %
             1000000007;
  return dp[i][k] % 1000000007;
}
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, -1, sizeof(dp));
  int res = util(arr, n, k, 0);
  cout << res;
  return 0;
}
