#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, b, mod;
  cin >> n >> m >> b >> mod;
  vector<int> A(n, 0);
  for (int i = (0); i < (n); i++) {
    cin >> A[i];
  }
  vector<vector<long long> > dp(1000, vector<long long>(1000, 0));
  dp[0][0] = 1;
  for (int p = (0); p < (n); p++) {
    for (int bug = (0); bug < (b + 1); bug++) {
      for (int write = (0); write < (m + 1); write++) {
        if (bug + A[p] <= b && dp[bug][write] > 0) {
          dp[bug + A[p]][write + 1] =
              (dp[bug + A[p]][write + 1] + dp[bug][write]) % mod;
        }
      }
    }
  }
  long long ans = 0;
  for (int i = (0); i < (b + 1); i++) ans = (ans + dp[i][m]) % mod;
  cout << (ans % mod) << endl;
  return 0;
}
