#include <bits/stdc++.h>
using namespace std;
int a[105];
int dp[105][100005];
int main() {
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i <= k; ++i) {
    if (i) dp[0][i] = dp[0][i - 1];
    if (i <= a[0]) dp[0][i]++;
  }
  for (int i = 1; i < n; ++i) {
    dp[i][0] = 1;
    for (int j = 1; j <= k; ++j) {
      dp[i][j] = dp[i][j - 1];
      dp[i][j] +=
          (dp[i - 1][j] - (j - a[i] - 1 >= 0 ? dp[i - 1][j - a[i] - 1] : 0) +
           1000000007) %
          1000000007;
      dp[i][j] %= 1000000007;
    }
  }
  cout << (dp[n - 1][k] - dp[n - 1][k - 1] + 1000000007) % 1000000007 << "\n";
  return 0;
}
