#include <bits/stdc++.h>
using namespace std;
int n, m, b, p;
int a[600];
int dp[510][510];
int main() {
  cin >> n >> m >> b >> p;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = a[i]; k <= b; k++)
        dp[j][k] = (dp[j][k] + dp[j - 1][k - a[i]]) % p;
  int ans = 0;
  for (int i = 0; i <= b; i++) ans = (ans + dp[m][i]) % p;
  cout << ans << endl;
  return 0;
}
