#include <bits/stdc++.h>
using namespace std;
int n, lines, bugs, mod;
int f[505][505];
int main() {
  scanf("%d %d %d %d", &n, &lines, &bugs, &mod);
  f[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    for (int j = 0; j < lines; j++)
      for (int k = 0; k + a <= bugs; k++)
        f[j + 1][k + a] = (f[j + 1][k + a] + f[j][k]) % mod;
  }
  int ans = 0;
  for (int i = 0; i <= bugs; i++) ans = (ans + f[lines][i]) % mod;
  printf("%d\n", ans);
}
