#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18 + 1LL;
int mod = 1e9 + 7LL;
void solve();
void ITO();
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ITO();
  int t = 1;
  while (t--) solve();
  return 0;
}
const int N = 501;
int32_t arr[N];
int32_t dp[2][N][N];
int n;
void solve() {
  int m, b;
  cin >> n >> m >> b >> mod;
  for (int i = 0; i < n; i++) cin >> arr[i];
  dp[0][0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= m; j++) {
      for (int k = 0; k <= b; k++) {
        int a = (i & 1);
        dp[a][j][k] = 0;
        dp[0][0][0] = 1;
        int b = (!a);
        if (i > 0) {
          if (j > 0 and k - arr[i] >= 0)
            (dp[a][j][k] += dp[a][j - 1][k - arr[i]]) %= mod;
          (dp[a][j][k] += dp[b][j][k]) %= mod;
        } else {
          if (j > 0 and k - arr[i] >= 0)
            (dp[a][j][k] += dp[a][j - 1][k - arr[i]]) %= mod;
        }
      }
    }
  }
  int res = 0;
  for (int i = 0; i <= b; i++) (res += dp[((n - 1) & 1)][m][i]) %= mod;
  cout << res;
  cout << "\n";
  return;
}
void ITO() {}
