#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int A[510];
int n, m, b, mod;
long long dp[500 + 1 + 9][500 + 2 + 9];
int build() {
  memset(dp, 0, sizeof dp);
  dp[0][0] = 1;
  for (int c = 1; c <= b; c++) dp[0][c] = 0;
  for (int i = 0; i < n; i++)
    for (int r = 1; r <= m; r++) {
      for (int c = 0; c <= b; c++) {
        {
          if (c - A[i] >= 0) dp[r][c] = (dp[r][c] + dp[r - 1][c - A[i]]) % mod;
        }
      }
    }
  int ret = 0;
  for (int c = 0; c <= b; c++) ret = (ret + dp[m][c]) % mod;
  return ret;
}
int main() {
  read_file(false);
  while (cin >> n >> m >> b >> mod) {
    for (int i = 0; i < n; i++) cin >> A[i];
    cout << build() << endl;
  }
}
