#include <bits/stdc++.h>   using namespace std;   long long bigmod(long long p, long long e, long long M) {     long long ret = 1;     for (; e > 0; e >>= 1) {       if (e & 1) ret = (ret * p) % M;       p = (p * p) % M;     }     return ret;   }   long long extended(long long a, long long b, long long &x, long long &y) {     a = abs(a);     b = abs(b);     long long g, x1, y1;     if (!b) {       x = 1;       y = 0;       g = a;       return g;     }     g = extended(b, a % b, x1, y1);     x = y1;     y = x1 - (a / b) * y1;     return g;   }   long long modinverse(long long a, long long M) { return bigmod(a, M - 2, M); }   long long bpow(long long p, long long e) {     long long ret = 1;     for (; e > 0; e >>= 1) {       if (e & 1) ret = (ret * p);       p = (p * p);     }     return ret;   }   int toInt(string s) {     int sm;     stringstream ss(s);     ss >> sm;     return sm;   }   int toLlint(string s) {     long long int sm;     stringstream ss(s);     ss >> sm;     return sm;   }   string convertInt(long long number) {     if (number == 0) return  0 ;     string temp =   ;     string returnvalue =   ;     while (number > 0) {       temp += number % 10 + 48;       number /= 10;     }     for (int i = 0; i < temp.length(); i++)       returnvalue += temp[temp.length() - i - 1];     return returnvalue;   }   long long ar[550], n, m, b, modd;   long long dp[550][550];   int main() {     long long n, m, b, modd;     cin >> n >> m >> b >> modd;     for (int i = 1; i <= n; i++) {       cin >> ar[i];     }     for (int i = 1; i <= n; i++) {       if (ar[i] <= b) dp[1][ar[i]]++;       dp[1][ar[i]] %= 1000000007;       for (int j = 0; j <= b; j++) {         for (int k = 1; k <= m; k++) {           if (ar[i] + j > b) continue;           dp[k][ar[i] + j] += dp[k - 1][j];           dp[k][ar[i] + j] %= modd;         }       }     }     long long ans = 0;     for (int i = 0; i <= b; i++) {       ans += dp[m][i];       ans %= modd;     }     cout << ans << endl;   }   