#include <bits/stdc++.h>
using namespace std;
long long int dp[105][100005];
int main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v1(n);
  for (auto &it : v1) cin >> it;
  for (long long int i = 0; i <= v1[0]; i++) dp[0][i] = 1;
  for (long long int i = 1; i <= n - 1; i++) {
    vector<long long int> v2(k + 1);
    v2[0] = dp[i - 1][0];
    for (long long int j = 1; j <= k; j++)
      v2[j] =
          ((v2[j - 1] % 1000000007) + (dp[i - 1][j]) % 1000000007) % 1000000007;
    for (long long int j = 0; j <= k; j++) {
      if (j - v1[i] > 0)
        dp[i][j] = ((v2[j] % 1000000007) - (v2[j - v1[i] - 1]) % 1000000007) %
                   1000000007;
      else
        dp[i][j] = v2[j];
    }
  }
  cout << dp[n - 1][k];
}
