#include <bits/stdc++.h>
using namespace std;
long long *a, n;
long long dp[101][100005];
long long ways(long long i, long long left) {
  if (i == n) {
    return left == 0;
  }
  if (left == 0) {
    return 1;
  }
  if (dp[i][left] != -1) {
    return dp[i][left];
  }
  dp[i][left] = 0;
  for (long long j = 0; j <= a[i] && j <= left; j++) {
    dp[i][left] += ways(i + 1, left - j);
    dp[i][left] %= 1000000007;
  }
  return dp[i][left];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  memset(dp, -1, sizeof(dp));
  long long k;
  cin >> n >> k;
  a = new long long[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cout << ways(0, k);
}
