#include <bits/stdc++.h>
using namespace std;
int dp[100001][101];
const int h = 1e9 + 7;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  int x;
  cin >> x;
  for (int j = 0; j < x + 1; j++) {
    dp[j][1] = 1;
  }
  int sum = x;
  for (int j = 1; j <= n; j++) dp[0][j] = 1;
  for (int i = 2; i < n + 1; i++) {
    int a;
    cin >> a;
    sum += a;
    int g;
    for (int j = 1; j < sum + 1; j++) {
      g = min(a, j);
      for (int y = 0; y < g + 1; y++) {
        dp[j][i] = (dp[j][i] + dp[j - y][i - 1]) % h;
      }
    }
  }
  cout << dp[k][n] << endl;
}
