#include <bits/stdc++.h>
using namespace std;
inline void smax(int &x, int y) { x = max(x, y); }
inline void smin(int &x, int y) { x = min(x, y); }
inline int in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline long long lin() {
  long long x;
  scanf("%I64d", &x);
  return x;
}
inline void out(int x) { printf("%d ", x); }
inline void lout(long long x) { printf("%I64d ", x); }
const int MOD = 1e9 + 7;
const long double EPS = 1e-9;
const int INF = 1e9 + 10;
const long long LINF = 1e18;
const int N = 1e3 + 10;
const int maxn = 1e4 + 10;
const int MAXN = 1e5 + 10;
const int MN = 1e6 + 10;
int n, m, b, a[510], dp[2][510][510], mod, ans;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; i++) cin >> a[i];
  dp[0][0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j <= m; j++)
      for (int k = 0; k <= b; k++) {
        dp[i & 1][j][k] = dp[i & 1 ^ 1][j][k];
        if (j && a[i] <= k) dp[i & 1][j][k] += dp[i & 1][j - 1][k - a[i]];
        dp[i & 1][j][k] %= mod;
      }
  for (int i = 0; i <= b; i++) ans = (ans + dp[n & 1][m][i]) % mod;
  cout << ans;
}
