#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long n) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
    }
    n >>= 1;
    a *= a;
  }
  return p;
}
long long power(long long a, long long n, long long mod) {
  long long p = 1;
  while (n > 0) {
    if (n % 2) {
      p = p * a;
      p %= mod;
    }
    n >>= 1;
    a *= a;
    a %= mod;
  }
  return p % mod;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
long long n, k;
long long dp[100005][105];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1;
  while (t--) {
    cin >> n >> k;
    long long arr[n];
    for (long long i = 0; i < n; i++) {
      cin >> arr[i];
    }
    for (long long i = 0; i <= n; i++) {
      dp[0][i] = 1;
    }
    for (long long i = 1; i <= k; i++) {
      for (long long j = 1; j <= n; j++) {
        long long val = arr[j - 1];
        for (long long x = 0; x <= val; x++) {
          if (i >= x) {
            dp[i][j] = dp[i][j] % 1000000007 + dp[i - x][j - 1] % 1000000007;
            dp[i][j] = dp[i][j] % 1000000007;
          } else {
            break;
          }
        }
      }
    }
    cout << dp[k][n] << "\n";
  }
  return 0;
}
