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