#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const int oo = INT_MAX;
const int sz = 1e5 + 5;
int cache[2][501][501];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int tc = 1;
  while (tc--) {
    int n, m, b, MOD;
    cin >> n >> m >> b >> MOD;
    vector<int> a(n + 1);
    for (int i = 1; i < n + 1; ++i) cin >> a[i];
    cache[0][0][0] = 1;
    for (int i = 1; i < n + 1; ++i) {
      for (int j = 0; j < m + 1; ++j) {
        for (int bugs = 0; bugs < b + 1; ++bugs) {
          int idx = i & 1;
          cache[idx][j][bugs] = cache[idx ^ 1][j][bugs];
          if (j > 0 && bugs >= a[i])
            cache[idx][j][bugs] += cache[idx][j - 1][bugs - a[i]];
          cache[idx][j][bugs] %= MOD;
        }
      }
    }
    int ret = 0;
    for (int bugs = 0; bugs < b + 1; ++bugs)
      ret = (ret + cache[n & 1][m][bugs]) % MOD;
    cout << ret << "\n";
  }
}
