#include <bits/stdc++.h>
using namespace std;
int n, k;
long long arr[102];
long long dp[101][100005];
long long presum[101][100005];
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = n - 1; i >= 0; i--) {
    for (long long j = 0; j <= k; j++) {
      if (i == n - 1) {
        dp[i][j] = (j <= arr[i]);
      } else {
        dp[i][j] = presum[i + 1][min(arr[i], j)];
      }
    }
    presum[i][0] = dp[i][0];
    for (int j = 1; j <= k; j++) {
      presum[i][j] = presum[i][j - 1] + dp[i][j];
      presum[i][j] %= 1000000007;
    }
  }
  cout << dp[0][k] << endl;
}
