#include <bits/stdc++.h>
#pragma comment(linker, "/stack:16777216")
using namespace std;
int n, k;
long long a[110], dp[110][100010], pre[110][100010];
int main(int argc, char** argv) {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  dp[0][1] = 1;
  for (int i = 1; i <= k + 1; i++) {
    pre[0][i] = 1;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k + 1; j++) {
      int from = max(0ll, j - a[i] - 1);
      dp[i][j] = pre[i - 1][j] - pre[i - 1][from];
      dp[i][j] %= 1000000007;
      pre[i][j] = (pre[i][j - 1] + dp[i][j]) % 1000000007;
    }
  }
  cout << dp[n][k + 1] << endl;
  return 0;
}
