#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[110];
int dp[110][100010];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  int suma;
  for (int i = 1; i <= n; i++) {
    suma = 0;
    for (int j = 0; j <= k; j++) {
      suma = (suma + dp[i - 1][j] -
              (j - a[i] - 1 >= 0 ? dp[i - 1][j - a[i] - 1] : 0)) %
             1000000007;
      dp[i][j] = suma;
    }
  }
  cout << dp[n][k];
  return 0;
}
