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