#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const double EPS = 1e-10;
double zero(double d) { return d < EPS ? 0.0 : d; }
template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  return os << '(' << p.first << ',' << p.second << ')';
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &a) {
  os << '[';
  for (int i = 0; i < (int)(a.size()); i++) os << (i ? " " : "") << a[i];
  return os << ']';
}
long long fpow(long long a, long long k, int M) {
  long long res = 1ll;
  long long x = a;
  while (k != 0) {
    if ((k & 1) == 1) res = (res * x) % M;
    x = (x * x) % M;
    k >>= 1;
  }
  return res;
}
vector<string> split(const string &str, char delim) {
  vector<string> res;
  size_t current = 0, found;
  while ((found = str.find_first_of(delim, current)) != string::npos) {
    res.push_back(string(str, current, found - current));
    current = found + 1;
  }
  res.push_back(string(str, current, str.size() - current));
  return res;
}
const int MAXN = 510;
int dp[2][MAXN][MAXN];
int a[MAXN];
int main() {
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(8);
  ios_base::sync_with_stdio(false);
  int n, m, b, mod;
  cin >> n >> m >> b >> mod;
  for (int i = 0; i < (int)(n); i++) cin >> a[i];
  for (int i = 0; i < (int)(2); i++)
    for (int j = 0; j < (int)(MAXN); j++)
      for (int k = 0; k < (int)(MAXN); k++) dp[i][j][k] = 0;
  dp[0][0][0] = 1;
  for (int orig_i = 1; orig_i < (int)(n + 1); orig_i++) {
    int i = orig_i & 1;
    for (int j = 0; j < (int)(m + 1); j++) {
      for (int k = 0; k < (int)(b + 1); k++) {
        dp[i][j][k] = dp[i ^ 1][j][k];
        if (0 <= j - 1 && 0 <= k - a[orig_i - 1]) {
          dp[i][j][k] += dp[i][j - 1][k - a[orig_i - 1]];
        }
        dp[i][j][k] = (dp[i][j][k] % mod);
      }
    }
  }
  int res = 0;
  for (int i = 0; i < (int)(b + 1); i++) res = (res + dp[n % 2][m][i]) % mod;
  cout << (res % mod) << endl;
  return 0;
}
