#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N, K;
  cin >> N >> K;
  long long int i, j, k;
  vector<int> A(N + 1);
  long long int sum = 0;
  for (i = 1; i <= N; i++) {
    cin >> A[i];
    sum += A[i];
  }
  vector<vector<int>> DP(N + 1, vector<int>(K + 10, 0));
  DP[0][0] = 1;
  long long int ub = 0;
  for (i = 1; i <= N; i++) {
    ub = ub + A[i];
    for (j = 0; j <= ub && j <= K; j++) {
      for (k = j; k <= j + A[i] && k <= K; k++) {
        DP[i][k] += DP[i - 1][j] % 1000000007;
      }
    }
  }
  cout << DP[N][K] % 1000000007;
  return 0;
}
