#include <bits/stdc++.h>
using namespace std;
const int INF = 0x7fffffff;
const int N = 1e3 + 5;
inline int read() {
  int x = 0, rev = 0, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') rev = 1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return rev ? -x : x;
}
int n, m, b, mod, f[N][N], ans;
int main() {
  n = read(), m = read(), b = read(), mod = read();
  f[0][0] = 1;
  while (n--) {
    int x = read();
    for (int i = 1; i <= m; i++) {
      for (int j = x; j <= b; j++) {
        (f[i][j] += f[i - 1][j - x]) %= mod;
      }
    }
  }
  for (int i = 0; i <= b; i++) (ans += f[m][i]) %= mod;
  cout << ans << endl;
  return 0;
}
