#include <cstdio>
#include <cmath>
const int maxn = 10010;
bool hashTable[maxn] = {0}; //hash表
int main(){
int TSize,n,a; //这里的TSize作为hash表长,应该为素数
scanf("%d%d",&TSize,&n);
for(int i=0; i<n; i++){
scanf("%d",&a);
int M = a % TSize; //除留余数法
if(!hashTable[M]){
hashTable[M] = true; //标记位置
}else{
int step;
for(step=1; step<TSize; step++){
M = (a + step*step) % TSize; //正向平方探测法,改成 - 就是反向探测
if(!hashTable[M]){
hashTable[M] = true;
break;
}
}
if(step >= TSize){
printf("超出最大表长,无法保存");
}
}
}
return 0;
}