#include <bits/stdc++.h>
using namespace std;
const long long INF = 10000000000LL;
long long r197(long long n) { return n % 1000000007; }
vector<int> v[100001];
bool b[100005] = {};
struct edge {
  int score;
  int num;
};
int n;
int k;
int p[103];
int dp[100005][101];
long long reg(int m, int s) {
  if (dp[m][s] != -1) return dp[m][s];
  if (s == k) return 1;
  if (m == n) return 0;
  long long res = 0;
  for (int i = 0; i < p[m] + 1; ++i) {
    if (s + i > k) break;
    res = r197(res + (reg(m + 1, s + i)));
  }
  return dp[m][s] = res;
}
int main() {
  memset(dp, -1, sizeof(dp));
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> p[i];
  }
  cout << reg(0, 0) << endl;
  return 0;
}
