#include <bits/stdc++.h>
using namespace std;
const int N = 505;
int a[N];
int z[2][N][N];
int main() {
  int n, bl, bugs, md;
  scanf("%d %d %d %d", &n, &bl, &bugs, &md);
  for (int i = 0; i < int(n); i++) scanf("%d", &a[i]);
  z[0][0][0] = 1;
  for (int it = 1; it <= n; it++) {
    int i = it & 1;
    for (int j = 0; j <= bl; j++) {
      for (int k = 0; k <= bugs; k++) {
        z[i][j][k] = z[i ^ 1][j][k];
        if (j > 0 && k >= a[it - 1]) z[i][j][k] += z[i][j - 1][k - a[it - 1]];
        z[i][j][k] %= md;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= bugs; i++) {
    ans += z[n & 1][bl][i];
    ans %= md;
  }
  printf("%d\n", ans);
}
