Strongbox

No attempts yetTime limit1sMemory limit128 MB

Problem

Byteasar tests and certifies anti-burglary devices. He has just received a new kind of strongbox to test: a combinatorial safe. It is opened with a rotary dial, just like an ordinary combination safe, but the way it opens is different.

The dial can be set to nn different positions, numbered 00 to n1n-1. Some of these positions open the safe and the others do not. The set of opening positions has the following combinatorial property, which gives the safe its name: if xx and yy are both opening positions, then (x+y)modn(x + y) \bmod n is an opening position as well. This holds for x=yx = y too.

Byteasar tried kk distinct positions m1,m2,,mkm_1, m_2, \ldots, m_k. The first k1k-1 of them, m1,m2,,mk1m_1, m_2, \ldots, m_{k-1}, did not open the safe; only the last one, mkm_k, did. He does not intend to try any of the remaining positions. Using only what he has learned from the positions he tried, determine the maximum possible number of positions that open the safe.

Input

The first line contains two integers nn and kk separated by a single space, where 1k2500001 \le k \le 250\,000 and kn1014k \le n \le 10^{14}.

The second line contains kk distinct integers m1,m2,,mkm_1, m_2, \ldots, m_k separated by single spaces, where 0mi<n0 \le m_i < n.

The input is guaranteed to correspond to some combinatorial safe consistent with the description above: there exists a safe that positions m1,,mk1m_1, \ldots, m_{k-1} do not open and position mkm_k does.

Output

Print a single integer: the maximum number of dial positions that can open the safe.