#include <bits/stdc++.h>
using namespace std;
const int N = 101;
const int K = 1e5 + 5;
const int mod = 1e9 + 7;
int dp[N][K];
int pre[K];
int arr[N];
inline int add(int a, int b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
inline int mul(int a, int b) { return (long long)a * b % mod; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k;
  cin >> n >> k;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
    sum = sum + arr[i];
  }
  if (sum < k) {
    cout << 0 << "\n";
    return 0;
  }
  for (int i = 0; i <= arr[0]; ++i) {
    dp[0][i] = 1;
  }
  int ans = 1;
  int sofar = arr[0];
  for (int i = 1; i < n; ++i) {
    pre[0] = dp[i - 1][0];
    sofar = min(sofar + arr[i], k);
    for (int j = 1; j < K; ++j) {
      pre[j] = add(pre[j - 1], dp[i - 1][j]);
    }
    for (int j = 0; j <= sofar; ++j) {
      dp[i][j] = add(pre[j], -pre[0]);
    }
    ans = add(ans, dp[i][sofar]);
  }
  cout << ans;
  cout << "\n";
}
