#include <bits/stdc++.h>
using namespace std;
int n, m, b, x, M;
long long d[505][505], ans;
int main() {
  scanf("%d %d %d %d", &n, &m, &b, &M);
  d[0][0] = 1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    for (int second = 1; second < m + 1; second++)
      for (int t = x; t < b + 1; t++) {
        d[second][t] = (d[second][t] + d[second - 1][t - x]) % M;
      }
  }
  for (int t = 0; t < b + 1; t++) ans = (ans + d[m][t]) % M;
  printf("%I64d", ans);
  return 0;
}
