#include <bits/stdc++.h>
using namespace std;
int n, m, b, MOD;
long long dp[2][505][505];
int a[505];
int main() {
  int i, j, k;
  cin >> n >> m >> b >> MOD;
  for (i = 1; i < n + 1; ++i) cin >> a[i];
  bool cur, pre;
  cur = 1;
  pre = 0;
  for (i = 0; i < 2; ++i) {
    for (j = 0; j < n + 1; ++j) {
      for (k = 0; k < b + 1; ++k) dp[i][j][k] = 0;
    }
  }
  for (j = 1; j < n + 1; ++j) {
    for (k = 0; k < b + 1; ++k) {
      dp[cur][j][k] = 0;
      dp[cur][j][k] = dp[cur][j - 1][k];
    }
    dp[cur][j][a[j]] += 1;
    dp[cur][j][a[j]] %= MOD;
  }
  for (i = 2; i < m + 1; ++i) {
    cur ^= 1;
    pre ^= 1;
    for (j = 1; j < n + 1; ++j) {
      for (k = 0; k < b + 1; ++k) {
        dp[cur][j][k] = dp[cur][j - 1][k];
        if (k >= a[j]) dp[cur][j][k] += dp[pre][j][k - a[j]];
        dp[cur][j][k] %= MOD;
      }
    }
  }
  long long ans = 0;
  for (k = 0; k < b + 1; ++k) {
    ans += dp[cur][n][k];
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}
