#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> v;
int dcandy(int n, int k, int* arr, int& count, int i, vector<int>& m) {
  if (i == n) {
    v.push_back(m);
    return 0;
  }
  for (int j = 0; j <= arr[i]; j++) {
    m[i] = j;
    dcandy(n, k, arr, count, i + 1, m);
  }
  return 0;
}
int main() {
  int n, k;
  cin >> n >> k;
  int* arr = new int[n];
  for (int i = 0; i < n; i++) {
    int no;
    cin >> no;
    arr[i] = no;
  }
  vector<int> m(n, 0);
  int count = 0;
  int temp = 0;
  dcandy(n, k, arr, count, temp, m);
  for (auto i : v) {
    int summ = 0;
    for (auto j : i) {
      summ += j;
    }
    if (summ == k) {
      count++;
    }
    cout << endl;
  }
  cout << count;
  return 0;
}
