#include <bits/stdc++.h>
using namespace std;
int A[509][509];
int X[509];
int main() {
  int n, m, b, mod;
  while (scanf("%d %d %d %d", &n, &m, &b, &mod) == 4) {
    for (int i = 0; i < n; i++) scanf("%d", &X[i]);
    for (int i = 0; i <= m; i++)
      for (int j = 0; j <= b; j++) A[i][j] = 0;
    A[0][0] = 1;
    for (int i = 0; i < n; i++) {
      for (int i1 = 0; i1 < m; i1++)
        for (int j = 0; j <= b; j++)
          if (A[i1][j] != 0 && j + X[i] <= b) {
            A[i1 + 1][j + X[i]] = (A[i1 + 1][j + X[i]] + A[i1][j]) % mod;
          }
    }
    int sum = 0;
    for (int j = 0; j <= b; j++) sum = (sum + A[m][j]) % mod;
    printf("%d\n", sum);
  }
  return 0;
}
