#include <bits/stdc++.h>
using namespace std;
long long int N, k;
long long int dp[105][100005] = {0};
int32_t main() {
  cin >> N >> k;
  long long int arr[105];
  for (long long int i = 1; i < N + 1; i++) cin >> arr[i];
  for (long long int i = 0; i < 103; i++) dp[0][i] = 0;
  dp[0][0] = 1;
  for (long long int i = 1; i < N + 1; i++) {
    long long int sums[100005] = {0};
    sums[0] = dp[i - 1][0] % 1000000007;
    dp[i][0] = sums[0];
    for (long long int j = 1; j < arr[i] + 1; j++) {
      sums[j] = (sums[j - 1] + dp[i - 1][j]) % 1000000007;
      dp[i][j] = sums[j];
    }
  }
  cout << dp[N][k] << '\n';
}
