#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e2 + 50;
int n, m, b, mod, a[maxn], dp[maxn][maxn], ans = 0;
int main() {
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      for (int t = a[i]; t <= b; t++) {
        dp[j][t] = (dp[j][t] + dp[j - 1][t - a[i]]) % mod;
      }
    }
  }
  for (int i = 0; i <= b; i++) ans = (dp[m][i] + ans) % mod;
  cout << ans << '\n';
  return 0;
}
