#include <bits/stdc++.h>
using namespace std;
long long dp[101][100005];
long long sum[101][100005];
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 1; i <= n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i <= k; i++) {
    dp[0][k] = 0;
  }
  for (int i = 0; i <= n; i++) {
    dp[i][0] = 1;
    sum[i][0] = 1;
  }
  for (int i = 0; i <= k; i++) {
    sum[0][i] = ((i == 0) ? dp[0][0] : sum[0][i - 1] + dp[0][i]);
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      if (v[i] < j) {
        dp[i][j] = sum[i - 1][j] - sum[i - 1][j - v[i] - 1];
      } else {
        dp[i][j] = sum[i - 1][j];
      }
      sum[i][j] =
          (sum[i][j - 1] % 1000000007 + dp[i][j] % 1000000007) % 1000000007;
    }
  }
  cout << dp[n][k] % 1000000007 << endl;
  return 0;
}
