#include <bits/stdc++.h>
using namespace std;
const int INF = (1LL << 30) - 1;
const long long int LINF = (1LL << 62) - 1;
const int NMAX = 505;
int N, M, B, MOD, sol;
int A[NMAX];
int dp[2][NMAX][NMAX];
int main() {
  int i, j, k;
  cin.sync_with_stdio(false);
  scanf("%d%d%d%d", &N, &M, &B, &MOD);
  for (i = 1; i <= N; i++) scanf("%d", &A[i]);
  dp[0][0][0] = 1;
  for (i = 1; i <= N; i++)
    for (j = 0; j <= M; j++)
      for (k = 0; k <= B; k++) {
        dp[i & 1][j][k] = dp[(i - 1) & 1][j][k];
        if (j > 0 && k - A[i] >= 0)
          dp[i & 1][j][k] =
              (dp[i & 1][j][k] + dp[i & 1][j - 1][k - A[i]]) % MOD;
      }
  for (k = 0; k <= B; k++) sol = (sol + dp[N & 1][M][k]) % MOD;
  printf("%d\n", sol);
  return 0;
}
