#include <bits/stdc++.h>
using namespace std;
int dp[2][502][502];
int a[502];
int main() {
  int i, j, k, ans = 0, n, lines, bugs, mod, turn = 0;
  cin >> n >> lines >> bugs >> mod;
  for (i = 0; i < n; i++) cin >> a[i];
  dp[turn][0][0] = 1;
  for (i = 0; i < n; i++) {
    turn = !turn;
    for (j = 0; j <= bugs; j++) {
      for (k = 0; k <= lines; k++) {
        dp[turn][j][k] = dp[!turn][j][k];
        if (k > 0 && j >= a[i])
          dp[turn][j][k] = (dp[turn][j][k] + dp[turn][j - a[i]][k - 1]) % mod;
      }
    }
  }
  for (j = 0; j <= bugs; j++) ans = (ans + dp[turn][j][lines]) % mod;
  cout << ans << endl;
  return 0;
}
