#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n = 0, candies = 0, x = 1000000007;
  cin >> n >> candies;
  long long a[n + 1], ways[n + 1][candies + 1], ptr = 0;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 0; i <= n; i++)
    for (long long j = 0; j <= candies; j++) ways[i][j] = 0;
  for (long long i = 0; i <= a[1]; i++) ways[1][i] = 1;
  ptr = a[1];
  for (long long i = 2; i <= n; i++) {
    for (long long j = 0; j <= ptr; j++)
      for (long long k = 0; k <= a[i]; k++)
        if (j + k <= candies)
          ways[i][j + k] = (ways[i][j + k] % x + ways[i - 1][j] % x) % x;
    ptr += a[i];
  }
  cout << ways[n][candies];
}
