#include <bits/stdc++.h>
using namespace std;
template <typename T>
void swap(T& a, T& b) {
  T temp = a;
  a = b;
  b = temp;
}
void selfadd(long long int& a, long long int b) {
  a = a + b;
  if (a > 1000000007) a = a - 1000000007;
}
void selfsub(long long int& a, long long int b) {
  a = a - b + 1000000007;
  if (a > 1000000007) a = a - 1000000007;
}
const long long int N = 100005;
long long int dp[101][N];
vector<long long int> a;
void solve() {
  long long int n, k;
  cin >> n >> k;
  a.assign(n, 0);
  for (long long int i = 0; i <= n - 1; i++) cin >> a[i];
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long int i = 0; i <= a[0]; i++) dp[0][i] = 1;
  for (long long int i = 1; i < n; i++) {
    long long int sum = 0;
    for (long long int j = 0; j <= k; j++) {
      sum = dp[i - 1][j];
      if (j > 0) selfadd(sum, dp[i][j - 1]);
      if (j > a[i]) {
        selfsub(sum, dp[i - 1][j - a[i]]);
      }
      dp[i][j] = sum;
    }
  }
  cout << dp[n - 1][k];
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  { solve(); }
  return 0;
}
