#include <bits/stdc++.h>
using namespace std;
long long int f(long long int i, long long int candies);
long long int n, k;
long long int a[110];
vector<vector<long long int>> dp(110, vector<long long int>(100100, -1));
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> k;
  for (long long int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  cout << f(1, k) << endl;
  return 0;
}
long long int f(long long int i, long long int candies) {
  if (dp[i][candies] != -1) {
    return dp[i][candies];
  }
  if (candies < 0) {
    return 0;
  }
  if (i == n) {
    if (candies > a[i]) {
      return dp[i][candies] = 0;
    }
    return dp[i][candies] = 1;
  }
  long long int ways = 0;
  for (long long int j = 0; j <= a[i]; j++) {
    ways = (ways + f(i + 1, candies - j)) % 1000000007;
  }
  return dp[i][candies] = ways;
}
