#include <bits/stdc++.h>
using namespace std;
inline long long int get() {
  long long int c;
  long long int n = 0;
  while ((c = getchar()) >= '0' && c <= '9') n = (n << 3) + (n << 1) + c - '0';
  return n;
}
string IntToString(int a) {
  ostringstream temp;
  temp << a;
  return temp.str();
}
long long int powerwithmodulus(long long int base, long long int exponent,
                               long long int modulus) {
  long long int result = 1;
  base %= modulus;
  while (exponent > 0) {
    if (exponent % 2 == 1) result = (result * base) % modulus;
    exponent = exponent >> 1;
    base = (base * base) % modulus;
  }
  return result;
}
void printArray(int arr[], int n) {
  for (size_t i = 0; i < n; i++) cout << arr[i] << " ";
  cout << endl;
}
long long int largestPowerOf2(long long int n) {
  return (long long int)pow(2, floor(log(n) / log(2)));
}
long long int dp[2][512][512] = {0LL};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int n, m, b, mod;
  cin >> n >> m >> b >> mod;
  vector<int> bug(n);
  int count = 12345;
  for (int i = 0; i < n; i++) cin >> bug[i], count = min(count, bug[i]);
  dp[0][0][0] = 1;
  if (count * m > b)
    cout << 0 << endl;
  else {
    for (int i = 1; i <= n; i++) {
      int p = i & 1;
      for (int j = 0; j <= m; j++) {
        for (int k = 0; k <= b; k++) {
          dp[p][j][k] = dp[p ^ 1][j][k];
          if (j >= 1 and k >= bug[i - 1]) {
            dp[p][j][k] += dp[p][j - 1][k - bug[i - 1]];
          }
          dp[p][j][k] %= mod;
        }
      }
    }
    long long int ans = 0LL;
    for (int i = 0; i <= b; i++) {
      ans += dp[n & 1][m][i];
      ans %= mod;
    }
    cout << ans << endl;
  }
  return 0;
}
