#include <bits/stdc++.h>
using namespace std;
long long dp[510][510], bug[510], pdp[510][510];
int main() {
  int n, m, b, mod;
  scanf("%d %d %d %d", &n, &m, &b, &mod);
  for (int i = 1; i <= n; i++) cin >> bug[i];
  long long res = 0;
  dp[0][0] = 1;
  for (int i = 1; i <= n; i++) {
    memset(pdp, 0, sizeof pdp);
    pdp[0][0] = 1;
    for (int j = 1; j <= m; j++) {
      for (int k = 0; k <= b; k++) {
        if (k - bug[i] >= 0)
          pdp[j][k] = (pdp[j][k] + pdp[j - 1][k - bug[i]]) % mod;
        pdp[j][k] = (pdp[j][k] + dp[j][k]) % mod;
        if (i == n && j == m) res = (res + pdp[j][k]) % mod;
      }
    }
    for (int j = 1; j <= m; j++)
      for (int k = 0; k <= b; k++) dp[j][k] = pdp[j][k];
  }
  cout << res << endl;
}
