Practice

아직 제출이 없습니다시간 제한1초메모리 제한1024 MB

문제

John practiced for $N$ days in preparation for the olympiad. He solved $X_i$ tasks on day $i$.

After the olympiad he wanted to know whether there was a span of consecutive days when he solved exacly $Y$ tasks. In other words, are there integers $a$ and $b$ such that $1 \le a \le b \le N$ and $X_a + X_{a+1} + \ldots + X_b = Y$?

Write a program to help John answer that question.

입력

The first line of input contains $N$, the number of days ($1 \le N \le 1\,000$), and $M$, the number of questions ($1 \le M \le 1\,000\,000$).

The second line contains $N$ space-separated integers $X_i$ ($0 \le X_i \le 1\,000$, where $1 \le i \le N$), the numbers of tasks John solved each day.

The third line contains $M$ space-separated integers $Y_j$ ($1 \le Y_j \le 1\,000\,000$, where $1 \le j \le M$), the numbers of tasks in John's questions.

출력

Output $M$ lines, one per question. On the line $j$ output the word 'JAH', if there exists a span of consecutive days when John solved exactly $Y_j$ tasks, or the word 'EI', if there's no such span of days.