#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e2 + 50;
long long dp[maxn][maxn];
int n, m, b, mod;
int a[maxn];
signed main() {
  scanf("%d%d%d%d", &n, &m, &b, &mod);
  dp[0][0] = 1;
  for (register int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  for (register int i = 1; i <= n; ++i)
    for (register int j = 1; j <= m; ++j)
      for (register int k = a[i]; k <= b; ++k)
        dp[j][k] = (dp[j - 1][k - a[i]] + dp[j][k]) % mod;
  register int Ans_ = 0;
  for (register int i = 0; i <= b; ++i) (Ans_ += dp[m][i]) %= mod;
  printf("%d\n", Ans_);
  return 0;
}
