Yet another problem - MarisaOJ: Marisa Online Judge

Yet another problem

Time limit: 1000 ms
Memory limit: 256 MB
Given an array $A$ of $n$ integers and $q$ queries, each is an integers $k$. For each query, find the longest subarray contains only elements not bigger than $k$. ### Input - The first line contains 2 integers $n, q$. - The second line contains $n$ integers $A_i$. - The next $q$ lines, each line contains an integer $k$, a query. ### Output - Print $q$ lines, the $i^{th}$ is the answer to query $i$. ### Constraints - $1 \le n \le 10^5$. - $0 \le |A_i|, |k| \le 10^9$. ### Example Input: ``` 6 4 -2 5 6 10 -5 0 -10 5 -4 11 ``` Output: ``` 0 2 1 6 ```