#include <bits/stdc++.h>
inline int mod(int a, int m) { return a < m ? a : a - m; }
int main() {
  int dp[501][501] = {}, n, m, b, md, a;
  scanf("%d%d%d%d", &n, &m, &b, &md);
  std::fill(dp[0], dp[0] + b + 1, 1);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &a);
    for (int j = 1; j <= m; ++j)
      for (int k = a; k <= b; ++k)
        dp[j][k] = mod(dp[j][k] + dp[j - 1][k - a], md);
  }
  printf("%d\n", dp[m][b]);
  return 0;
}
