The Enchanted Forest Trail
Time limit: 2.0 sec
Memory limit: 256 MB
Problem Statement
Deep in the heart of the mystical lands lies the Enchanted Forest, where an ancient path is paved with magical stones. Each stone bears a positive integer that imbues it with a certain power. The wise wizard Eldrin has learned that hidden along this path is a contiguous segment of stones whose total magical power sums to exactly $M$, a secret constant known only to the ancients. However, not all stones are created equal—some possess a prime number as their power, enhancing their mystical properties.
Eldrin’s task is critical: in order to unlock the forest’s magic and secure passage for his allies, he must identify the contiguous segment of stones that sums exactly to $M$ and, among all possible segments with that property, has the maximum number of stones whose power is prime. If no such segment exists, the wizard must report failure.
Your task is to help Eldrin by writing a program to determine the maximum count of prime-powered stones in any contiguous segment of the path whose sum is exactly $M$.
## Input Format
- The first line contains two space-separated integers $N$ and $M$, where:
- $N \leq 10^5 $ is the number of magical stones along the path,
- $M$ is the target sum for the chosen segment.
- The second line contains $N$ space-separated positive integers denoting the power on each stone, each no more than 100.
## Output Format
- Output a single integer: the maximum number of prime numbers found in any contiguous segment of stones whose sum is exactly $M$.
- If there is no contiguous segment that sums to $M$, output $-1$.
## Examples
#### Input
5 10
2 3 5 1 1
#### Output
3
#### Input
4 7
1 2 3 1
#### Output
2