import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; void readV(T...)(ref T t){auto r=readln.splitter;foreach(ref v;t){v=r.front.to!(typeof(v));r.popFront;}} void main() { long d; int q; readV(d, q); struct P { long a, b; } auto inf = 2*10L^^18, m = 0L, rbt = redBlackTree!"a.a u.b) break; rm ~= po; u = P(u.a, max(u.b, po.b)); } foreach (rmi; rm) rbt.removeKey(rmi); m = max(m, u.b-u.a); rbt.insert(u); writeln(m); } }