#include <bits/stdc++.h>
const long long INF = 1e18L + 5;
using namespace std;
void max_self(long long &a, long long b) { a = max(a, b); }
void min_self(long long &a, long long b) { a = min(a, b); }
const long long M = 1e9 + 7;
void add_self(long long &a, long long b) {
  a += b;
  if (a >= M) {
    a -= M;
  }
}
char a[1005][1005];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<vector<long long>> dp(n + 1, vector<long long>(k + 1, 0));
  dp[0][0] = 1;
  for (long long child = 1; child <= n; ++child) {
    long long up_to;
    cin >> up_to;
    for (long long to_kid = 0; to_kid <= min(up_to, k); ++to_kid) {
      for (long long distributed = k; distributed >= to_kid; --distributed) {
        add_self(dp[child][distributed], dp[child - 1][distributed - to_kid]);
      }
    }
  }
  cout << dp[n][k];
}
