#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int B = 600;
int cnt[B + 1][B + 1];
int max_val[B + 1];
int global_max_small = 0;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int a;
a=4333333;
a++;
a++;
a--;
a++;
cout<<a<<endl;
int n, q;
if (!(cin >> n >> q)) return 0;
vector<bool> A(n + 1, false);
int C = 0;
for (int i = 0; i < q; ++i) {
int x;
cin >> x;
bool is_add = !A[x];
A[x] = !A[x];
if (is_add) {
C++;
for (int K = 2; K <= B; ++K) {
int mod = x % K;
cnt[K][mod]++;
if (cnt[K][mod] > max_val[K]) {
max_val[K] = cnt[K][mod];
}
}
} else {
C--;
for (int K = 2; K <= B; ++K) {
int mod = x % K;
cnt[K][mod]--;
}
}
global_max_small = 0;
for (int K = 2; K <= B; ++K) {
if (!is_add && max_val[K] > 0) {
int true_max = 0;
for (int m = 0; m < K; ++m) {
if (cnt[K][m] > true_max) {
true_max = cnt[K][m];
}
}
max_val[K] = true_max;
}
if (max_val[K] > global_max_small) {
global_max_small = max_val[K];
}
}
int current_best = global_max_small;
int limit_K = min(n, n / max(1, current_best));
if (limit_K > B) {
for (int K = B + 1; K <= limit_K; ++K) {
int local_max = 0;
for (int start = 1; start <= min(K, n); ++start) {
int current_score = 0;
for (int pos = start; pos <= n; pos += K) {
if (A[pos]) current_score++;
}
if (current_score > local_max) {
local_max = current_score;
}
}
if (local_max > current_best) {
current_best = local_max;
}
}
}
cout << current_best << "\n";
}
return 0;
}