#include <bits/stdc++.h>
using namespace std;
string s1, s2;
template <typename T>
void max_self(T &a, T b) {
  if (b >= a) {
    a = b;
  }
}
int dp[105][100005];
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int child = 0; child < n; child++) {
    for (int candy = 0; candy <= k; candy++) {
      if (child == 0 && a[child] >= candy)
        dp[child][candy] = 1;
      else {
        long long int sum = 0;
        for (int lcc = 0; lcc <= a[child]; lcc++) {
          if (candy - lcc >= 0 && child > 0) {
            sum += dp[child - 1][candy - lcc];
            if (sum >= 1e9 + 7) sum = sum - 1e9 + 7;
          }
        }
        dp[child][candy] = sum;
      }
    }
  }
  cout << dp[n - 1][k];
}
