#include <bits/stdc++.h>
long long n, m, cap, mod, b[503], dp[503][503], mx;
using namespace std;
int main() {
  cin >> n >> m >> cap >> mod;
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long i = 0; i < n; i++) cin >> b[i];
  for (long long p = 0; p < n; p++)
    for (long long l = 0; l <= m; l++)
      for (long long e = 0; e + b[p] <= cap; e++)
        dp[l + 1][e + b[p]] =
            ((dp[l + 1][e + b[p]]) % mod + dp[l][e] % mod) % mod;
  long long ans = 0;
  for (long long e = 0; e <= cap; e++) ans = (ans % mod + dp[m][e] % mod) % mod;
  cout << ans << endl;
  return 0;
}
