#include <bits/stdc++.h>
using namespace std;
long long int scan() {
  long long int t = 0;
  char c, ch;
  ch = getchar();
  if (ch == '-') {
    c = getchar();
  } else {
    c = ch;
  }
  while (c < '0' || c > '9') {
    c = getchar();
  }
  while (c >= '0' && c <= '9') {
    t = (t << 3) + (t << 1) + c - '0';
    c = getchar();
  }
  if (ch == '-') {
    return -t;
  } else {
    return t;
  }
}
int dp[505][505] = {0};
int main() {
  ios::sync_with_stdio(false);
  long long int i, j, k, t, n, m, x, y, b;
  cin >> n >> m >> b >> t;
  for (i = 0; i < 505; i++) dp[0][i] = 1 % t;
  while (n--) {
    cin >> x;
    for (i = 1; i <= m; i++) {
      for (j = 0; j <= b; j++) {
        if (j >= x) dp[i][j] += dp[i - 1][j - x], dp[i][j] %= t;
      }
    }
  }
  int ans = dp[m][b];
  cout << ans << "\n";
  return 0;
}
