#include <bits/stdc++.h>
using namespace std;
long long mat[2][510][510];
long long a[510], n, m, x, mod, bugs, i, k, j;
int main() {
  scanf("%I64d %I64d %I64d %I64d", &n, &m, &bugs, &mod);
  for (i = 1; i <= n; i++) scanf("%I64d", &a[i]);
  memset(mat, 0, sizeof(mat));
  mat[0][0][0] = 1;
  x = 1;
  for (i = 1; i <= n; i++, x ^= 1) {
    for (j = 0; j <= m; j++) {
      for (k = 0; k <= bugs; k++) {
        mat[x][j][k] = mat[x ^ 1][j][k];
        if (j > 0 && k - a[i] >= 0)
          mat[x][j][k] = (mat[x][j][k] + mat[x][j - 1][k - a[i]]) % mod;
      }
    }
  }
  long long ans = 0;
  for (i = 0; i <= bugs; i++) ans = (ans + mat[x ^ 1][m][i]) % mod;
  printf("%I64d\n", ans);
}
