#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, unsigned long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) {
      res = res * x;
    }
    y = y >> 1;
    x = x * x;
  }
  return res;
}
long long int powermod(long long int x, unsigned long long int y,
                       long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) {
      res = (res * x) % p;
    }
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int dp[101][100005], n, k;
vector<long long int> v;
long long int solve(long long int i, long long int sum) {
  if (i == n) {
    return (sum == 0);
  }
  if (dp[i][sum] != -1) return dp[i][sum];
  long long int ans = 0;
  for (long long int j = (long long int)(0);
       j < (long long int)(min(v[i], sum) + 1); j++) {
    ans += solve(i + 1, sum - j);
    ans %= 1000000007;
  }
  dp[i][sum] = ans;
  return ans;
}
int32_t main() {
  cin >> n >> k;
  for (long long int i = (long long int)(0); i < (long long int)(n); i++) {
    long long int t;
    cin >> t;
    v.push_back(t);
  }
  memset(dp, -1, sizeof(dp));
  cout << solve(0, k);
  return 0;
}
