#include <bits/stdc++.h>
using namespace std;
const int N = 505, bugs = 505, lines = 505;
int dp[2][bugs][lines];
void solve() {
  int n, m, B, p;
  cin >> n >> m >> B >> p;
  vector<long long int> a(n + 1);
  for (long long int i = 1; i <= n; i += 1) {
    cin >> a[i];
  }
  dp[0][0][0] = 1;
  for (long long int i = 1; i <= n; i += 1) {
    for (long long int b = 0; b <= B; b += 1) {
      for (long long int l = 0; l <= m; l += 1) {
        dp[1][b][l] = dp[0][b][l];
      }
    }
    for (long long int l = 0; l <= m; l += 1) {
      for (long long int b = 0; b <= B; b += 1) {
        if (b - a[i] >= 0 and l - 1 >= 0)
          (dp[1][b][l] += dp[1][b - a[i]][l - 1]) %= p;
      }
    }
    for (long long int l = 0; l <= m; l += 1) {
      for (long long int b = 0; b <= B; b += 1) {
        dp[0][b][l] = dp[1][b][l];
      }
    }
  }
  int ans = 0;
  for (long long int b = 0; b <= B; b += 1) {
    (ans += dp[0][b][m]) %= p;
  }
  cout << ans << '\n';
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int T = 1;
  for (long long int c = 1; c <= T; c += 1) {
    solve();
  }
}
