#include <bits/stdc++.h>
using namespace std;
int n, m, b, mod, cev;
int dp[2][505][505], a[505];
int main() {
  scanf("%d %d %d %d", &n, &m, &b, &mod);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dp[0][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 (!j || k - a[i] < 0)
          dp[i & 1][j][k] = (dp[(i & 1) ^ 1][j][k]) % mod;
        else
          dp[i & 1][j][k] =
              (dp[(i & 1) ^ 1][j][k] + dp[i & 1][j - 1][k - a[i]]) % mod;
      }
  for (int i = 0; i <= b; i++) cev = (cev + dp[n & 1][m][i]) % mod;
  printf("%d", cev);
}
