#include <bits/stdc++.h>
using namespace std;
int arr[105], n, k;
int dp[101][100001];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i <= k; i++) dp[0][i] = 0;
  for (int i = 0; i <= n; i++) dp[i][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      int count = min(arr[i - 1], j);
      while (count != -1) {
        dp[i][j] = (dp[i][j] + dp[i - 1][j - count]) % 1000000007;
        --count;
      }
    }
  }
  cout << dp[n][k] << endl;
  return 0;
}
