#include <bits/stdc++.h>
using namespace std;
int c[2][501][501];
int main() {
  int n, m, b, mod;
  scanf("%d%d%d%d", &n, &m, &b, &mod);
  int a[n + 1];
  for (long i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(c, 0, sizeof(c));
  c[0][0][0] = 1;
  for (long i = 1; i <= n; i++)
    for (long j = 0; j <= m; j++)
      for (long k = 0; k <= b; k++) {
        c[(i & 1)][j][k] = c[(i & 1) ^ 1][j][k];
        if (k >= a[i] && j > 0) c[(i & 1)][j][k] += c[(i & 1)][j - 1][k - a[i]];
        c[(i & 1)][j][k] = c[(i & 1)][j][k] % mod;
      }
  int ans = 0;
  for (int i = 0; i <= b; i++) {
    ans += c[n & 1][m][i];
    ans = ans % mod;
  }
  printf("%d\n", ans);
}
