#include <bits/stdc++.h>
using namespace std;
long long n, m, b, mod, a[5000];
long long f[2][500 + 50][500 + 50];
int cur = 0;
int main(int argc, char *argv[]) {
  cin >> n >> m >> b >> mod;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  f[cur][0][0] = 1;
  for (int i = 1; i <= n; ++i) {
    cur ^= 1;
    for (int j = 0; j <= m; ++j)
      for (int k = 0; k <= b; ++k) {
        f[cur][j][k] = f[cur ^ 1][j][k];
        if (j > 0 && k >= a[i]) f[cur][j][k] += f[cur][j - 1][k - a[i]];
        f[cur][j][k] %= mod;
      }
  }
  long long ans = 0;
  for (int i = 0; i <= b; ++i) ans += f[cur][m][i];
  cout << ans % mod << endl;
  return 0;
}
