#include <bits/stdc++.h>
inline long long sbt(long long x) { return __builtin_popcount(x); }
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
long long n, m, b, md;
long long dp[513][513], a[513];
int32_t main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  cin >> n >> m >> b >> md;
  for (long long i = 0; i < n; i++) cin >> a[i];
  dp[0][0] = 1;
  for (long long i = 0; i < n; i++)
    for (long long j = 1; j <= m; j++)
      for (long long k = a[i]; k <= b; k++)
        dp[j][k] = (dp[j][k] + dp[j - 1][k - a[i]]) % md;
  long long sum = 0;
  for (long long i = 0; i <= b; i++) sum = (sum + dp[m][i]) % md;
  cout << sum;
  return 0;
}
