#include <bits/stdc++.h>
using namespace std;
double EPS = 1e-9;
int INF = 2000000000;
long long INFF = 8000000000000000000LL;
double PI = acos(-1);
int dx[8] = {-1, 0, 0, 1, -1, -1, 1, 1};
int dy[8] = {0, 1, -1, 0, -1, 1, -1, 1};
const int Nmax = 505;
int dp[Nmax][Nmax];
void init() {
  for (int(i) = (0); (i) < (Nmax); ++(i))
    for (int(j) = (0); (j) < (Nmax); ++(j)) dp[i][j] = 0;
};
int N, M, B, MOD;
int A[Nmax];
int solve() {
  init();
  int ans = 0;
  dp[0][0] = 1;
  for (int(n) = (0); (n) < (N); ++(n))
    for (int(m) = (1); (m) <= (M); ++(m))
      for (int(b) = (A[n]); (b) <= (B); ++(b)) {
        dp[m][b] = (dp[m][b] + dp[m - 1][b - A[n]]) % MOD;
      }
  for (int(b) = (0); (b) <= (B); ++(b)) {
    ans += dp[M][b] % MOD;
    ans %= MOD;
  }
  return ans;
};
int main() {
  cin >> N >> M >> B >> MOD;
  for (int(i) = (0); (i) < (N); ++(i)) cin >> A[i];
  cout << solve() << endl;
  return 0;
};
