#include <bits/stdc++.h>
using namespace std;
int a[105];
long long 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 <= a[0]; ++i) {
    dp[0][i] = i + 1;
  }
  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);
      dp[i][j] %= 1000000007;
    }
  }
  cout << (dp[n - 1][k] - (k > 0 ? dp[n - 1][k - 1] : 0) + 1000000007) %
              1000000007
       << "\n";
  return 0;
}
