#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long arr[n];
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
  }
  vector<long long> dp(k + 1);
  dp[0] = 1;
  for (long long i = 0; i < n; i++) {
    for (long long j = k; j >= 0; j--) {
      for (long long l = 1; l <= arr[i]; l++) {
        if (dp[j] && l + j <= k) {
          dp[l + j] += dp[j];
          dp[l + j] %= 1000000007;
        }
      }
    }
  }
  cout << dp[k] << endl;
}
