package yukicoder; import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.Collections; public class No1457 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int M = scan.nextInt(); int X = scan.nextInt(); int Y = scan.nextInt(); int Z = scan.nextInt(); List A = new ArrayList(); for (int i=0; i < N; i++) { A.add(scan.nextInt()); } scan.close(); Collections.sort(A); int remove = Collections.binarySearch(A, Y + 1); if (remove < 0) { remove = - remove - 1; } int remain = Collections.binarySearch(A, X); if (remain < 0) { remain = - remain - 1; } int remainN = N - remain; if (remainN > M) { System.out.println("Handicapped"); return; } int remainSum = A.subList(remain, N).stream().reduce(0, (a, b) -> a + b); List B = A.subList(remove, remain); int min = remainN > 0 ? 0 : 1; int max = M - remainN; int n = remain - remove; if (n == 0) { if (remainSum == remainN * Z) { System.out.println(1); } else { System.out.println(0); } return; } int maxsum = B.stream().mapToInt(Integer::intValue).sum(); int maxval = maxsum - Collections.max(B); long[][][] dp = new long[n][max+1][maxsum+1]; dp[0][0][0] = 1; dp[0][1][B.get(0)] = 1; for (int i=0; i < n-1; i++) { for (int j=0; j <= max; j++) { for (int k=0; k <= maxval; k++) { dp[i+1][j][k] += dp[i][j][k]; if (j+1 <= max) { dp[i+1][j+1][k+B.get(i+1)] += dp[i][j][k]; } } } } long cnt = 0; for (int j=min; j <= max; j++) { int k = Z*(j+remainN)-remainSum; if (k >= 0 && k <= maxsum) { cnt += dp[n-1][j][k]; } } System.out.println(cnt); } }