#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007ll;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> dp(k + 1, 0);
  dp[0] = 1;
  for (long long i = 1; i <= n; i++) {
    long long a;
    cin >> a;
    for (long long j = k; j >= 1; j--) {
      long long temp = 0;
      for (long long p = j - 1; p >= max(0LL, j - a); p--) temp += dp[p];
      dp[j] += temp;
    }
  }
  cout << dp[k];
  return 0;
}
