#include <bits/stdc++.h>
using namespace std;
using i16 = short int;
using u16 = short unsigned int;
using i32 = int;
using u32 = unsigned int;
using i64 = long long int;
using u64 = long long unsigned int;
constexpr i32 MOD = 1e9 + 7;
vector<vector<i32>> memo;
i64 cnt = 0;
i32 dp(const vector<i32>& max_candies, i32 K, i32 idx = 0) {
  if (idx >= max_candies.size()) {
    if (K == 0) {
      return 1;
    }
    return 0;
  }
  if (K == 0) {
    return 1;
  }
  if (memo[idx][K] != -1) {
    return memo[idx][K];
  }
  cnt++;
  i32 res = 0;
  for (i32 i = 0; i <= max_candies[idx]; i++) {
    if (i > K) {
      break;
    }
    res += dp(max_candies, K - i, idx + 1);
    res %= MOD;
  }
  memo[idx][K] = res;
  return res;
}
i32 main() {
  i32 n, k;
  cin >> n >> k;
  vector<i32> max_candies(n);
  for (i32 i = 0; i < n; i++) {
    cin >> max_candies[i];
  }
  sort(max_candies.begin(), max_candies.end(), greater<i32>());
  memo = vector<vector<i32>>(n + 1, vector<i32>(k + 1, -1));
  cout << dp(max_candies, k) << '\n';
}
