#include <bits/stdc++.h>
using namespace std;
int n, m, b, mod, a[510], c[2][510][510], i, j, k, otv, l0, l1;
int main() {
  scanf("%d %d %d %d", &n, &m, &b, &mod);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  c[0][0][0] = 1;
  l0 = 0;
  l1 = 1;
  for (i = 1; i <= n; i++) {
    for (j = 0; j <= m; j++)
      for (k = 0; k <= b; k++) {
        c[l1][j][k] = c[l0][j][k];
        if (j > 0 && k - a[i - 1] >= 0)
          c[l1][j][k] = (c[l1][j][k] + c[l1][j - 1][k - a[i - 1]]) % mod;
      }
    swap(l0, l1);
  }
  otv = 0;
  for (k = 0; k <= b; k++) otv = (otv + c[l0][m][k]) % mod;
  printf("%d\n", otv);
  return 0;
}
