#include <bits/stdc++.h>
using namespace std;
long long dp[505][505];
int main() {
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i <= 504; i++) dp[0][i] = 1;
  long long n, m, b, mod, a, ans;
  cin >> n >> m >> b >> mod;
  for (long long i = 1; i <= n; i++) {
    cin >> a;
    for (long long j = 1; j <= m; j++)
      for (long long k = a; k <= b; k++)
        dp[j][k] = (dp[j][k] + dp[j - 1][k - a]) % mod;
  }
  cout << dp[m][b];
  return 0;
}
