At Narxoz University, the Dean believes in perfect equality: every teacher must give the same number of lectures — no more, no less. Inspired by this fairness, a student named Aigerim defines a good segment of an array as follows:
> A segment is good if every distinct number in it appears exactly the same number of times.
You are given an array $$$a$$$ of length $$$n$$$, where each element represents the ID of a teacher assigned to a lecture. $$$ \\ $$$ You are also given $$$q$$$ queries. For each query, you are asked whether the segment of the array from position $$$l$$$ to $$$r$$$ (inclusive) is good.
Help Aigerim determine which segments follow the dean's rule of fairness.
The first line contains two integers $$$n$$$ and $$$q$$$ $$$(1 \le n,q \le 10^{5},q \bmod 5 = 0 )$$$ — the number of lectures and the number of queries.$$$ \\ $$$ The second line contains $$$n$$$ integers $$$a_1, a_2, \cdots, a_n$$$ $$$(1 \le a_i \le n)$$$— the teacher IDs assigned to each lecture.$$$ \\ $$$ Each of the next $$$q$$$ lines contains two integers $$$l$$$ and $$$r$$$ $$$(1\le l \le r \le n)$$$ — the boundaries of the segment being checked.
For each query, print yes if the segment is good, otherwise print no.
After printing the answers to a group of queries, do not forget to output the end of line and flush the output buffer. Otherwise, you may get the Idleness Limit Exceeded verdict. To flush the buffer, use:
You have to flush the output buffer after the $$$5$$$-th, $$$10$$$-th, $$$15$$$-th query (and so on), i. e. after each query with index divisible by $$$5$$$. After that, you can read the next group of queries.
7 51 2 3 4 4 5 51 51 44 54 72 3
no yes yes yes yes