#include <bits/stdc++.h>
using namespace std;
long long int dp[101][100002];
long long int v[101][100002];
long long int n, k;
long long int a[101];
long long int solve(long long int index, long long int total) {
  if (total > k) return 0;
  if (index == n) {
    if (total == k)
      return 1;
    else
      return 0;
  }
  if (v[index][total] != 0) return dp[index][total];
  v[index][total] = 1;
  long long int ans = 0;
  for (int i = 0; i <= a[index]; i++) {
    ans = (ans + solve(index + 1, total + i) + 1000000007) % 1000000007;
  }
  return dp[index][total] = ans;
}
int main() {
  long long int i, j;
  cin >> n >> k;
  for (i = 0; i < n; i++) cin >> a[i];
  cout << solve(0, 0);
}
