#include <bits/stdc++.h>
using namespace std;
int n, m, b, mod, a[501], f[2][501][501];
void nhap() {
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; ++i) cin >> a[i];
}
void xuli() {
  f[0][0][0] = 1;
  int fl = 0;
  for (int i = 1; i <= n; ++i) {
    fl ^= 1;
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= b; ++k) {
        f[fl][j][k] = f[fl ^ 1][j][k];
        if (j && k >= a[i])
          f[fl][j][k] = (f[fl][j][k] + f[fl][j - 1][k - a[i]]) % mod;
      }
  }
  int ans = 0;
  for (int i = 0; i <= b; ++i) ans = (ans + f[fl][m][i]) % mod;
  cout << ans;
}
int main() {
  nhap();
  xuli();
}
