#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using LD = long double;
using VI = vector<int>;
using PI = pair<int, int>;
const int mod = 1e9 + 7;
int n, k;
VI a;
vector<VI> dp;
int DFS(int idx, int rem) {
  if (idx == n) return rem == 0;
  int res = 0;
  for (int i = 0; i <= a[idx]; ++i) {
    if (rem - i >= 0) {
      if (dp[idx + 1][rem - i] != -1) {
        res += dp[idx + 1][rem - i];
        res %= mod;
      } else {
        dp[idx + 1][rem - i] = DFS(idx + 1, rem - i);
        res += dp[idx + 1][rem - i];
        res %= mod;
      }
    }
  }
  return dp[idx][rem] = res;
}
void Excalibur() {
  while (cin >> n >> k) {
    a.resize(n);
    dp = vector<VI>(n + 1, VI(k + 2, -1));
    for (auto &x : a) cin >> x;
    cout << DFS(0, k) << "\n";
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  Excalibur();
  return 0;
}
