#include <bits/stdc++.h>
using namespace std;
int min(int a, int b) { return a < b ? a : b; }
long long int dp[101][100001];
long long int ans(int coins, int sum, int a[]) {
  if (dp[coins][sum] != -1) return dp[coins][sum];
  if (sum == 0) return 1;
  if (coins == 0) return 0;
  long long int cnt = 0;
  for (int i = 0; i <= min(a[coins - 1], sum); i++) {
    cnt = (cnt + (ans(coins - 1, sum - i, a)) % 1000000007) % 1000000007;
  }
  dp[coins][sum] = cnt;
  return cnt;
}
int main() {
  int n, i, k, sum = 0;
  cin >> n >> k;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    sum += a[i];
  }
  for (i = 0; i <= n; i++) {
    for (int j = 0; j <= k; j++) dp[i][j] = -1;
  }
  int rem = sum - k;
  if (rem < 0)
    cout << 0 << endl;
  else if (rem == 0)
    cout << 1;
  else {
    cout << ans(n, k, a);
  }
}
