#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, 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 modi(long long int a, long long int m) {
  return power(a, m - 2, m);
}
int32_t main() {
  long long int n, k;
  cin >> n >> k;
  vector<long long int> v(n + 1, 0);
  for (long long int i = 1; i <= n; i++) cin >> v[i];
  long long int dp[n + 1][k + 1];
  for (long long int i = 0; i <= n; i++) {
    for (long long int j = 0; j <= k; j++) {
      dp[i][j] = 0;
    }
  }
  dp[0][0] = 1;
  for (long long int i = 1; i <= n; i++) {
    dp[i][0] = 1;
    for (long long int j = 1; j <= k; j++) {
      for (long long int k = 0; k <= v[i]; k++) {
        if (j >= k) dp[i][j] = (dp[i][j] + dp[i - 1][j - k]) % 1000000007;
      }
    }
  }
  cout << (dp[n][k]) << endl;
}
