#include <bits/stdc++.h>
using namespace std;
const int maxN = 502;
long long c[maxN][maxN];
long long a[maxN];
int n, m, b, md;
int main() {
  cin >> n >> m >> b >> md;
  for (int i = 1; i <= n; i++) cin >> a[i];
  c[0][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < m; j++)
      for (int t = 0; t <= b - a[i]; t++)
        if (c[j][t] > 0) {
          c[j + 1][t + a[i]] = (c[j + 1][t + a[i]] + c[j][t]) % md;
        }
  long long ans = 0;
  for (int i = 0; i <= b; i++) ans = (ans + c[m][i]) % md;
  cout << ans << endl;
  return 0;
}
