#include <bits/stdc++.h>
using namespace std;
long long mod, dp[508][508];
int a[501];
int n, m, b;
int main() {
  while (cin >> n >> m >> b >> mod) {
    for (int i = 1; i <= n; i++) cin >> a[i];
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i <= b; i++) dp[0][i] = 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]]) % mod;
        }
    long long ans = 0;
    cout << dp[m][b] << endl;
  }
}
