#include <bits/stdc++.h>
using namespace std;
long long dp[2][510][510], mod;
bitset<510> visited[510][510];
int a[510];
long long solve(int n, int m, int b) {
  dp[0][0][0] = 1ll;
  for (int nn = 1; nn <= n; nn++) {
    for (int mm = 0; mm <= 500; mm++) {
      for (int bb = 0; bb <= 500; bb++) {
        dp[nn % 2][mm][bb] = dp[(nn + 1) % 2][mm][bb];
        if (a[nn] <= bb) {
          dp[nn % 2][mm][bb] += dp[nn % 2][mm - 1][bb - a[nn]];
          dp[nn % 2][mm][bb] %= mod;
        }
      }
    }
  }
  long long sol = 0ll;
  for (int i = 0; i < int(b + 1); i++) {
    sol += dp[n % 2][m][i];
    sol %= mod;
  }
  return sol;
}
int main() {
  int n, m, b;
  long long sol = 0ll;
  scanf("%d %d %d %lld", &n, &m, &b, &mod);
  for (int i = 0; i < int(n); i++) scanf("%d", &a[i + 1]);
  printf("%lld\n", solve(n, m, b));
}
