#include <bits/stdc++.h>
using namespace std;
int n, m, b, mod;
int bug[505], dp[2][505][505], ans;
bool f;
int main() {
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; i++) {
    cin >> bug[i];
  }
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    f = !f;
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= b; k++) {
        dp[f][j][k] = dp[!f][j][k];
        if (j > 0 && k >= bug[i]) {
          dp[f][j][k] += dp[f][j - 1][k - bug[i]];
        }
        dp[f][j][k] %= mod;
      }
    }
  }
  for (int i = 0; i <= b; i++) {
    ans += dp[f][m][i];
    ans %= mod;
  }
  cout << ans;
  return 0;
}
