// // Created by darian on 07.06.24. // #include using namespace std; using ll = long long; int main() { ll x; cin >> x; int n; cin >> n; map distances; distances[x] = 1; set> lines = {{0, x}}; for (int i{}; i < n; i++) { ll t; cin >> t; auto it = lines.lower_bound({t, t}); --it; auto p = *it; lines.erase(p); lines.insert({p.first, t}); lines.insert({t, p.second}); if (distances[p.second - p.first] == 1) distances.erase(p.second - p.first); distances[t - p.first]++; distances[p.second - t]++; cout << (*distances.rbegin()).first << endl; } }