#include<iostream>
using namespace std;
int dp[505][505][505];
int main(){
int n,m,b;
long int mod;
cin>>n>>m>>b>>mod;
int bug[n+1],i,j,k;
for(i=0;i<n;i++)
cin>>bug[i];
int cnt=0;
dp[0][0][0]=1;
for(i=1;i<=n;i++)
dp[i][0][0]=1;
for(i=1;i<=n;i++){
for(j=1;j<=m;j++){
for(k=0;k<=b;k++){
// either this ith programmer writes this line or doesnot
dp[i][j][k]= dp[i-1][j][k]; // programmer doesnot write
if((k>=bug[i-1]))
dp[i][j][k]+= dp[i][j-1][k-bug[i-1]]; // programmer writes
dp[i][j][k]%=mod;
}
}
}
// for(i=1;i<=n;i++){
for(j=0;j<=b;j++){
cnt+= dp[n][m][j];
cnt%=mod;
// }
}
cout<<cnt<<endl;
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgZHBbNTA1XVs1MDVdWzUwNV07CgppbnQgbWFpbigpewoJCglpbnQgbixtLGI7Cglsb25nIGludCBtb2Q7CgljaW4+Pm4+Pm0+PmI+Pm1vZDsKCQoJaW50IGJ1Z1tuKzFdLGksaixrOwoJCglmb3IoaT0wO2k8bjtpKyspCgkJY2luPj5idWdbaV07CgkKCWludCBjbnQ9MDsKCQoJZHBbMF1bMF1bMF09MTsKCQoJZm9yKGk9MTtpPD1uO2krKykKCQlkcFtpXVswXVswXT0xOwoJCglmb3IoaT0xO2k8PW47aSsrKXsKCQlmb3Ioaj0xO2o8PW07aisrKXsKCQkJZm9yKGs9MDtrPD1iO2srKyl7CgkJCQkvLyBlaXRoZXIgdGhpcyBpdGggcHJvZ3JhbW1lciB3cml0ZXMgdGhpcyBsaW5lIG9yIGRvZXNub3QKCQkJCWRwW2ldW2pdW2tdPSBkcFtpLTFdW2pdW2tdOyAvLyBwcm9ncmFtbWVyIGRvZXNub3Qgd3JpdGUKCQkJCQoJCQkJaWYoKGs+PWJ1Z1tpLTFdKSkKCQkJCWRwW2ldW2pdW2tdKz0g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