#include <bits/stdc++.h>
using namespace std;
int dp[509][509];
int a[509];
int main() {
  int n, m, b, mod;
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int x = 1; x <= n; x++) {
    for (int i = 0; i < m; i++) {
      for (int j = 0; j <= b; j++) {
        if (j + a[x] <= b) dp[i + 1][j + a[x]] += dp[i][j];
        if (dp[i + 1][j + a[x]] >= mod) dp[i + 1][j + a[x]] -= mod;
      }
    }
  }
  int ans = 0;
  for (int j = 0; j <= b; j++) {
    ans += dp[m][j];
    if (ans >= mod) ans -= mod;
  }
  cout << ans << endl;
}
