#include <bits/stdc++.h>
using namespace std;
long long f[501][501];
int main() {
  int n, m, b;
  long long mod;
  scanf("%d %d %d %lld", &n, &m, &b, &mod);
  f[0][0] = 1;
  for (int i = 1, a; i <= n; i += 1) {
    scanf("%d", &a);
    for (int j = 1; j <= m; j += 1)
      for (int k = a; k <= b; k += 1)
        f[j][k] = (f[j][k] + f[j - 1][k - a]) % mod;
  }
  long long ans = 0;
  for (int i = 0; i <= b; i += 1) ans = (ans + f[m][i]) % mod;
  printf("%lld\n", ans);
  return 0;
}
