#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 0;
  char ch = getchar();
  while (!isdigit(ch)) f |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = x * 10 + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
int a[507], f[507][507];
int main() {
  int n = read(), m = read(), b = read(), mod = read();
  for (int i = 1; i <= n; ++i) a[i] = read();
  for (int i = 0; i <= b; ++i) f[0][i] = 1;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      for (int k = a[i]; k <= b; ++k)
        f[j][k] = (f[j][k] + f[j - 1][k - a[i]]) % mod;
  printf("%d\n", f[m][b]);
  return 0;
}
