#include <bits/stdc++.h>
using namespace std;
long long dp[2][505][505];
long long w[505];
long long n, m, b, mod;
int32_t main() {
  cin >> n >> m >> b >> mod;
  for (long long i = 1; i <= n; i++) {
    cin >> w[i];
  }
  for (long long i = 0; i <= m; i++) {
    for (long long j = 0; j <= b; j++) {
      dp[0][i][j] = dp[1][i][j] = 0;
    }
  }
  dp[0][0][0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = 0; j <= m; j++) {
      for (long long k = 0; k <= b; k++) {
        dp[(i % 2)][j][k] = dp[!(i % 2)][j][k];
        dp[(i % 2)][j][k] %= mod;
        if (j - 1 >= 0 && k - w[i] >= 0)
          dp[(i % 2)][j][k] += dp[(i % 2)][j - 1][k - w[i]];
        dp[(i % 2)][j][k] %= mod;
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i <= b; i++) {
    ans += dp[(n % 2)][m][i];
    ans %= mod;
  }
  cout << ans << endl;
}
