#include <bits/stdc++.h>
using namespace std;
const int maxn = 505;
int n, m, b, mod, a[maxn], dp[2][maxn][maxn];
int main() {
  scanf("%d%d%d%d", &n, &m, &b, &mod);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= b; k++) {
        int cur = i & 1, pre = !cur;
        dp[cur][j][k] = dp[pre][j][k];
        if (j > 0 && k - a[i] >= 0) dp[cur][j][k] += dp[cur][j - 1][k - a[i]];
        dp[cur][j][k] %= mod;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= b; i++) ans = (ans + dp[n & 1][m][i]) % mod;
  printf("%d\n", ans);
  return 0;
}
