#include <bits/stdc++.h>
using namespace std;
void yes() {
  cout << "YES"
       << "\n";
}
void no() {
  cout << "NO"
       << "\n";
}
long long int powmod(long long int x, long long int y, long long int mod) {
  long long int ans = 1;
  while (y) {
    if (y % 2 == 1) {
      ans = (ans * x) % mod;
    }
    x = (x * x) % mod;
    y /= 2;
  }
  return ans;
}
long long int dp[105][100005];
long long int pre[105][100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    v.push_back(x);
  };
  dp[0][0] = 1;
  pre[0][0] = 1;
  for (long long int i = 1; i < n + 5; i++) {
    dp[i][0] = 1;
    pre[i][0] = 1;
  }
  for (long long int i = 1; i < k + 5; i++) {
    dp[0][i] = 0;
    pre[0][i] = 0;
  }
  for (long long int i = 1; i < n + 1; i++) {
    long long int x = v[i - 1];
    for (long long int j = 1; j < k + 5; j++) {
      pre[i - 1][j] = (pre[i - 1][j - 1] + dp[i - 1][j]) % 1000000007;
    }
    for (long long int j = 0; j < k + 5; j++) {
      if (j - x - 1 < 0)
        dp[i][j] = pre[i - 1][j] % 1000000007;
      else
        dp[i][j] = (pre[i - 1][j] - pre[i - 1][j - x - 1]) % 1000000007;
    }
  }
  cout << dp[n][k] << " ";
  return 0;
}
