#include <bits/stdc++.h>
using namespace std;
int dp[2][501][501], a[501];
int n, m, b, mod;
int main() {
  scanf("%d %d %d %d", &n, &m, &b, &mod);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  for (int i = (0); i < (b + 1); ++i) dp[n & 1][m][i] = 1;
  for (int p = n - 1; p >= 0; p--)
    for (int sb = b; sb >= 0; sb--)
      for (int sm = m; sm >= 0; sm--)
        dp[p & 1][sm][sb] =
            (dp[(p + 1) & 1][sm][sb] + (sm + 1 <= m and sb + a[p] <= b
                                            ? dp[p & 1][sm + 1][sb + a[p]]
                                            : 0)) %
            mod;
  printf("%d\n", dp[0][0][0]);
  return 0;
}
