#include <bits/stdc++.h>
using namespace std;
long long f[600][600], ans;
long long a[600];
long long p;
int i, j, n, m, b, k;
int main() {
  scanf("%d%d%d%I64d", &n, &m, &b, &p);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  f[0][0] = 1;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      for (k = a[i]; k <= b; k++) f[j][k] = (f[j][k] + f[j - 1][k - a[i]]) % p;
  ans = 0;
  for (i = 0; i <= b; i++) ans = (ans + f[m][i]) % p;
  printf("%I64d\n", ans);
  return 0;
}
