#include <bits/stdc++.h>
using namespace std;
int mod;
void add(int& x, int y) { x = (x + y) % mod; }
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, b;
  cin >> n >> m >> b >> mod;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  vector<vector<vector<int> > > d(
      2, vector<vector<int> >(m + 1, vector<int>(b + 1, 0)));
  d[0][0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      for (int k = 0; k <= b; ++k) {
        add(d[1][j][k], d[0][j][k]);
        if (k >= a[i - 1] && j > 0) add(d[1][j][k], d[1][j - 1][k - a[i - 1]]);
      }
    }
    d[0] = d[1];
    d[1] = vector<vector<int> >(m + 1, vector<int>(b + 1, 0));
  }
  int ans = 0;
  for (int i = 0; i <= b; ++i) add(ans, d[0][m][i]);
  cout << ans << "\n";
  return 0;
}
