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