#include <bits/stdc++.h>
using namespace std;
void read_file(bool outToFile = true) {}
int A[500 + 9];
int n, m, b, mod;
int dp[2][500 + 9 + 1][500 + 9 + 1];
int build() {
  int p = 0;
  for (int c = 0; c <= b; c++) dp[p][0][c] = dp[!p][0][c] = 1;
  for (int c = 0; c <= b; c++)
    for (int r = 1; r <= m; r++) dp[p][r][c] = 0;
  for (int i = n - 1; i >= 0; i--) {
    p = !p;
    for (int r = 1; r <= m; r++)
      for (int c = b; c >= 0; c--)
        if (A[i] + c <= b)
          dp[p][r][c] = (dp[!p][r][c] + dp[p][r - 1][c + A[i]]) % mod;
        else
          dp[p][r][c] = dp[!p][r][c];
  }
  return dp[p][m][0];
}
int dp1[500 + 9 + 1][500 + 9 + 1];
int build1() {
  memset(dp1, 0, sizeof dp1);
  dp1[0][0] = 1;
  for (int c = 1; c <= b; c++) dp1[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) dp1[r][c] = (dp1[r][c] + dp1[r - 1][c - A[i]]) % mod;
      }
    }
  }
  int ret = 0;
  for (int c = 0; c <= b; c++) ret = (ret + dp1[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;
  }
}
