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