Halloween treats

No attempts yetTime limit1sMemory limit128 MB

Problem

Every Halloween the children run into the same trouble. Each neighbour is only willing to hand out a fixed total number of sweets that day, no matter how many children knock, so a child who arrives too late may end up with nothing. To keep things fair, the children pool everything they collect and split it evenly, giving every child the same whole number of sweets with none left over.

There are $c$ children and $n$ neighbours living along the street, numbered $1$ to $n$ in the order the children pass their houses. Neighbour $i$ gives out a total of $a_i$ sweets. The children will visit one consecutive block of neighbours — the neighbours $l, l+1, \ldots, r$ for some $1 \le l \le r \le n$ — and they want the collected total $a_l + a_{l+1} + \cdots + a_r$ to be divisible by $c$ so that it can be shared evenly. Because every neighbour gives at least one sweet, such a total is a positive multiple of $c$, so each child receives at least one sweet.

Input

The input contains several test cases.

The first line of each test case contains two integers $c$ and $n$ ($1 \le c \le n \le 100000$): the number of children and the number of neighbours. The second line contains $n$ space-separated integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 100000$), where $a_i$ is the total number of sweets neighbour $i$ hands out.

The last test case is followed by a line containing two zeros, which must not be processed.

Output

For each test case, output on one line the neighbours the children should visit.

Consider every consecutive block $l, l+1, \ldots, r$ (with $1 \le l \le r \le n$) whose total $a_l + a_{l+1} + \cdots + a_r$ is divisible by $c$. Among all such blocks, pick the one whose right endpoint $r$ is as small as possible; if several blocks share that smallest $r$, pick the one whose left endpoint $l$ is as small as possible. Print the indices $l, l+1, \ldots, r$ of that block in increasing order, separated by single spaces.

If no such block exists, print no sweets instead.