#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  long long K;
  long long MOD = 1e9 + 7;
  cin >> N >> K;
  long long pascal_triangle[K + N][N + 1];
  fill(*pascal_triangle, *pascal_triangle + (N + K) * (N + 1), 0);
  for (long long i = 0; i <= K + N; ++i) {
    for (long long j = 0; j <= min(N, i); ++j) {
      if ((i == j) || (j == 0))
        pascal_triangle[i][j] = 1;
      else
        pascal_triangle[i][j] =
            pascal_triangle[i - 1][j - 1] + pascal_triangle[i - 1][j];
    }
  }
  long long incorrect_ways = 0;
  long long total_ways = pascal_triangle[K + N - 1][N - 1] % MOD;
  for (int i = 0; i < N; ++i) {
    long long val;
    cin >> val;
    incorrect_ways += pascal_triangle[K - (val + 1) + N - 1][N - 1] % MOD;
  }
  cout << (total_ways - incorrect_ways) % MOD;
  return 0;
}
