#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

ll mod = 1e9+7;

ll dp[101][100001];
ll a[100];
int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int j = 0; j <= k; j++)
    dp[0][j] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= k; j++) {
      dp[i][j] = (dp[i-1][j]-(j > a[i-1] ? dp[i-1][j-a[i-1]-1] : 0) + (j ? dp[i][j-1] : 0))%mod;
    }
  }
  cout << ((dp[n][k]-(k ? dp[n][k-1] : 0))%mod+mod)%mod << endl;
}
