#include <bits/stdc++.h>
using namespace std;
int dp[200][100010], arr[200];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    dp[i][0] = 1;
  }
  for (int i = 0; i <= m; i++) dp[1][i] = (i <= arr[1] ? 1 : 0);
  for (int i = 2; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      int extra = 0;
      if (j > arr[i]) extra = dp[i - 1][j - arr[i] - 1];
      dp[i][j] =
          (((dp[i - 1][j] + dp[i][j - 1]) - extra) + 1000000007) % 1000000007;
    }
  }
  cout << dp[n][m] % 1000000007 << "\n";
  return 0;
}
