#include <bits/stdc++.h>
using namespace std;
const int maxn = 505;
int n, m, b, mod;
int w[maxn];
int dp[maxn][maxn];
int main() {
  scanf("%d%d%d%d", &n, &m, &b, &mod);
  for (int i = 1; i <= n; ++i) scanf("%d", &w[i]);
  dp[0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      for (int k = 0; k <= b; ++k) {
        if (0 == j)
          dp[j][k] = 1;
        else if (k - w[i] >= 0)
          dp[j][k] = (dp[j][k] + dp[j - 1][k - w[i]]) % mod;
      }
    }
  }
  printf("%d\n", dp[m][b]);
  return 0;
}
