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