#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[100001];
long long sum[100001];
long long dp[101][100001];
long long minimumcal(long long a, long long b) {
  if (a < b) {
    return a;
  } else {
    return b;
  }
}
long long maximumcal(long long a, long long b) {
  if (a > b) {
    return a;
  } else {
    return b;
  }
}
long long cal(long long i, long long candies) {
  if (i == 0 && candies == 0) {
    return 1;
  }
  if (i == 0 && candies != 0) {
    dp[i][candies] = 0;
    return 0;
  }
  if (dp[i][candies] == -1) {
    long long maxima = minimumcal(a[i], candies);
    long long minima = maximumcal(0, candies - sum[i - 1]);
    long long ways = 0, j;
    for (j = maxima; j >= minima; j--) {
      if (i == 3 && candies - j == 3) {
      }
      if (dp[i - 1][candies - j] == -1) {
        dp[i - 1][candies - j] = cal(i - 1, candies - j);
      }
      ways += dp[i - 1][candies - j];
      ways = ways % 1000000007;
    }
    dp[i][candies] = ways % 1000000007;
  }
  return dp[i][candies];
}
int main() {
  int i, j;
  cin >> n >> k;
  sum[0] = 0;
  for (i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = a[i] + sum[i - 1];
  }
  for (i = 0; i < 101; i++) {
    for (j = 0; j < 100001; j++) {
      dp[i][j] = -1;
    }
  }
  dp[0][0] = 1;
  long long ans = cal(n, k);
  cout << ans << endl;
  return 0;
}
