#include <bits/stdc++.h>
using namespace std;
int n, m, b, mod;
int a[505];
int dp[505][505] = {0};
int main() {
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; i++) cin >> a[i];
  for (int i = 0; i <= b; i++) dp[0][i] = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= b; k++) {
        if (k < a[i]) continue;
        if (j < 1) continue;
        dp[j][k] += dp[j - 1][k - a[i]];
        while (dp[j][k] >= mod) dp[j][k] -= mod;
      }
    }
  }
  int tot = 0;
  for (int i = 0; i <= b; i++) {
    tot += dp[m][i];
    while (tot >= mod) tot -= mod;
  }
  cout << tot << endl;
  return 0;
}
