#include <bits/stdc++.h>
using namespace std;
signed main(){
int x, n;
cin >> x >> n;
set<int> st;
multiset<int> dis;
st.insert(0);
st.insert(x);
dis.insert(x-0);
for(int i = 0; i < n; i++){
int p;
cin >> p;
auto it = st.insert(p);
dis.insert(p-*prev(it.first, 1));
dis.insert(*next(it.first, 1) - p);
auto it1 = dis.lower_bound(*next(it.first, 1) - *prev(it.first, 1));
dis.erase(it1);
cout << *prev(dis.end(), 1) << " ";
}
}
// 0 3 6 8
// 3 3 2
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnNpZ25lZCBtYWluKCl7CglpbnQgeCwgbjsKCWNpbiA+PiB4ID4+IG47CglzZXQ8aW50PiBzdDsKCW11bHRpc2V0PGludD4gZGlzOwoJc3QuaW5zZXJ0KDApOwoJc3QuaW5zZXJ0KHgpOwoJZGlzLmluc2VydCh4LTApOwoJZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CgkJaW50IHA7CgkJY2luID4+IHA7CgkJYXV0byBpdCA9IHN0Lmluc2VydChwKTsKCQlkaXMuaW5zZXJ0KHAtKnByZXYoaXQuZmlyc3QsIDEpKTsKCQlkaXMuaW5zZXJ0KCpuZXh0KGl0LmZpcnN0LCAxKSAtIHApOwoJCWF1dG8gaXQxID0gZGlzLmxvd2VyX2JvdW5kKCpuZXh0KGl0LmZpcnN0LCAxKSAtICpwcmV2KGl0LmZpcnN0LCAxKSk7CgkJZGlzLmVyYXNlKGl0MSk7CgkJY291dCA8PCAqcHJldihkaXMuZW5kKCksIDEpIDw8ICIgIjsKCX0KfQovLyAwICAzIDYgOAoKLy8gMyAzIDIgIA==