#include <bits/stdc++.h>
using namespace std;
const int N = 501;
int A[N];
int dp[N][N];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m, b, mod;
  cin >> n >> m >> b >> mod;
  for (int i = 0; i < n; i++) cin >> A[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= b; k++) {
        if (k >= A[i - 1] && j > 0) {
          dp[j][k] = (dp[j][k] + dp[j - 1][k - A[i - 1]]) % mod;
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i <= b; i++) ans = (ans + dp[m][i]) % mod;
  cout << ans << endl;
}
