#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int X = 0, w = 0;
  char ch = 0;
  while (!isdigit(ch)) {
    w |= ch == '-';
    ch = getchar();
  }
  while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
  return w ? -X : X;
}
int a[600];
int dp[600][600];
int main() {
  int n, code, bug, mod;
  while (~scanf("%d", &n)) {
    memset(dp, 0, sizeof(dp));
    code = read();
    bug = read();
    mod = read();
    dp[0][0] = 1;
    for (int i = 1; i <= n; i++) {
      a[i] = read();
    }
    int ans = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= code; j++) {
        for (int k = a[i]; k <= bug; k++) {
          dp[j][k] += dp[j - 1][k - a[i]];
          dp[j][k] %= mod;
        }
      }
    }
    for (int i = 0; i <= bug; i++) {
      ans += dp[code][i];
      ans %= mod;
    }
    printf("%d\n", ans);
  }
}
