#include <bits/stdc++.h>
using namespace std;
int const N = (int)2e6 + 1, INF = (int)1e9 + 1, MOD = (int)1e9 + 7;
long long mypow(long long a, long long b, int mod) {
  long long rv = 1;
  while (b) {
    if (b % 2) rv = rv * a % mod;
    a = a * a % mod;
    b /= 2;
  }
  return rv;
}
bool ok, used[N], same;
long long n, m, ans, k, cur, cnt, pos;
long long b, mod, a[600], dp[600][600];
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 p = 0; p <= b - a[i]; p++) {
        dp[j][p + a[i]] = (dp[j][p + a[i]] + dp[j - 1][p]) % mod;
      }
    }
  }
  for (int i = 0; i <= b; i++) ans = (ans + dp[m][i]) % mod;
  cout << ans;
  return 0;
}
