#include <bits/stdc++.h>
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
using namespace std;
long long tests;
long long n, m, b, MOD, dp[5256][5256], a[5256], ans;
void solve() {
  scanf("%I64d%I64d%I64d%I64d", &n, &m, &b, &MOD);
  for (int i = 1; i <= n; i += 1) {
    scanf("%I64d", &a[i]);
  }
  dp[0][0] = 1;
  for (int i = 1; i <= n; i += 1)
    for (int j = 0; j <= m; j += 1)
      for (int k = 0; k <= b; k += 1)
        if (k + a[i] <= b) {
          dp[j + 1][k + a[i]] += dp[j][k];
          dp[j + 1][k + a[i]] %= MOD;
        }
  for (int i = 0; i <= b; i += 1) {
    ans += dp[m][i];
    ans %= MOD;
  }
  printf("%I64d", ans);
}
int main() { solve(); }
