#include <bits/stdc++.h>
using namespace std;
long long counter = 0;
long long dp[101][100001];
long long data[101];
long long sum[101];
long long cal(long long n, long long candiesleft) {
  if (n == 0 && candiesleft > 0) {
    return 0;
  } else if (n >= 0 && candiesleft <= 0) {
    return 1;
  } else if (dp[n][candiesleft] == -1) {
    long long i = 0, ways = 0, choose, left;
    for (i = 0; i <= data[n]; i++) {
      counter++;
      choose = i;
      left = candiesleft - choose;
      if (left > 0) {
        if (left <= sum[n]) {
          if (dp[n - 1][left] == -1) {
            dp[n - 1][left] = cal(n - 1, left);
          }
          ways += (dp[n - 1][left]) % 1000000007;
        }
      } else if (left == 0) {
        ways += 1;
      } else {
        break;
      }
    }
    dp[n][candiesleft] = ways;
    return (dp[n][candiesleft]) % 1000000007;
  }
}
int main() {
  long long n, k, i, j, z;
  cin >> n >> k;
  for (i = 0; i <= 100; i++) {
    data[i] = -1;
    sum[i] = 0;
    for (j = 0; j <= 100000; j++) {
      dp[i][j] = -1;
    }
  }
  for (i = 1; i <= n; i++) {
    cin >> data[i];
  }
  sum[1] = 0;
  for (i = 2; i <= n; i++) {
    sum[i] = sum[i - 1] + data[i - 1];
  }
  long long left = k - data[n];
  long long ans = 0;
  if (left <= sum[n]) {
    ans = cal(n, k);
  }
  cout << "" << ans << endl;
  return 0;
}
