#include <bits/stdc++.h>
using namespace std;
int mpow(int base, int exp);
void ipgraph(int m);
const int mod = 1000000007;
const int N = 3e5, M = N;
long long int dp[300000];
int main() {
  ios_base::sync_with_stdio(0);
  long long int t, n, i, j, k, m;
  t = 1;
  int T;
  for (T = 1; 1 < t + 1 ? T < t + 1 : T > t + 1; 1 < t + 1 ? T += 1 : T -= 1) {
    cin >> n >> k;
    long long int a[n];
    dp[0] = 1;
    for (i = 0; i < n; i++) {
      cin >> a[i];
      for (int j = k; j >= 0; j--) {
        for (int h = 1; h <= min(a[i], k - j); h++) {
          dp[j + h] += dp[j] % mod;
        }
      }
    }
    cout << dp[k] % mod;
  }
}
