#include <bits/stdc++.h>
using namespace std;
int n, m, b, bs, er[600], dp[55][505][505];
void add(int &a, int b) {
  a += b;
  if (a >= bs) a -= bs;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m >> b >> bs;
  for (int i = 0; i < n; i++) cin >> er[i];
  dp[0][0][0] = 1;
  for (int iter = 0; iter < n; iter++) {
    for (int i = 0; i <= m; i++)
      for (int j = 0; j <= b; j++) dp[1 ^ (iter % 2)][i][j] = 0;
    for (int i = 0; i <= m; i++) {
      for (int j = 0; j <= b; j++) {
        if (j + er[iter] <= b)
          add(dp[iter % 2][i + 1][j + er[iter]], dp[iter % 2][i][j]);
        add(dp[(iter + 1) % 2][i][j], dp[iter % 2][i][j]);
      }
    }
  }
  int answ = 0;
  for (int i = 0; i <= b; i++) add(answ, dp[n % 2][m][i]);
  cout << answ << endl;
  return 0;
}
