#include <bits/stdc++.h>
using namespace std;
vector<long long> bug;
long long n, m, b, mod;
void mysol() {
  cin >> n >> m >> b >> mod;
  bug.resize(n);
  for (long long &a : bug) cin >> a;
  vector<vector<long long>> dp(502, vector<long long>(502, 0));
  dp[0][0] = 1;
  for (long long idx = 0; idx < n; idx++)
    for (long long lines = 0; lines <= m; lines++)
      for (long long bugs = 0; bugs <= b; bugs++)
        if (lines > 0 and bugs - bug[idx] >= 0)
          dp[lines][bugs] =
              (dp[lines][bugs] + dp[lines - 1][bugs - bug[idx]]) % mod;
  long long ans = 0;
  for (long long bugs = 0; bugs <= b; bugs++) ans = (ans + dp[m][bugs]) % mod;
  cout << ans << '\n';
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  mysol();
  return 0;
}
