/// Social Distancing
/// Author: Qwerty
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
int n, m;
pair<long long, long long> a[MAXN];
bool check(long long x){
int cnt = 1;
long long cur = a[cnt].first;
int f = 1;
while (cur + x <= a[m].second){
while (cur + x > a[cnt].second){
cnt++;
}
cur = max(cur + x, a[cnt].first);
f++;
}
return f >= n;
}
int main(){
//freopen("socdist.in", "r", stdin);
//freopen("socdist.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> m;
for (int i = 1; i <= m; i++){
cin >> a[i].first >> a[i].second;
}
sort(a + 1, a + m + 1);
long long lo = 1;
long long hi = 1e18;
long long ans = 0;
while (lo <= hi){
long long mid = (lo + hi) / 2;
if (check(mid)){
ans = max(ans, mid);
lo = mid + 1;
}
else hi = mid - 1;
}
cout << ans << '\n';
}
Ly8vIFNvY2lhbCBEaXN0YW5jaW5nCi8vLyBBdXRob3I6IFF3ZXJ0eQojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgTUFYTiA9IDFlNSArIDEwMDsKaW50IG4sIG07CnBhaXI8bG9uZyBsb25nLCBsb25nIGxvbmc+IGFbTUFYTl07CmJvb2wgY2hlY2sobG9uZyBsb25nIHgpewogICAgaW50IGNudCA9IDE7CiAgICBsb25nIGxvbmcgY3VyID0gYVtjbnRdLmZpcnN0OwogICAgaW50IGYgPSAxOwogICAgd2hpbGUgKGN1ciArIHggPD0gYVttXS5zZWNvbmQpewogICAgICAgIHdoaWxlIChjdXIgKyB4ID4gYVtjbnRdLnNlY29uZCl7CiAgICAgICAgICAgIGNudCsrOwogICAgICAgIH0KICAgICAgICBjdXIgPSBtYXgoY3VyICsgeCwgYVtjbnRdLmZpcnN0KTsKICAgICAgICBmKys7CiAgICB9CiAgICByZXR1cm4gZiA+PSBuOwp9CmludCBtYWluKCl7CiAgICAvL2ZyZW9wZW4oInNvY2Rpc3QuaW4iLCAiciIsIHN0ZGluKTsKICAgIC8vZnJlb3Blbigic29jZGlzdC5vdXQiLCAidyIsIHN0ZG91dCk7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwogICAgY2luLnRpZSgwKTsKICAgIGNpbiA+PiBuID4+IG07CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBtOyBpKyspewogICAgICAgICBjaW4gPj4gYVtpXS5maXJzdCA+PiBhW2ldLnNlY29uZDsKICAgIH0KICAgIHNvcnQoYSArIDEsIGEgKyBtICsgMSk7CiAgICBsb25nIGxvbmcgbG8gPSAxOwogICAgbG9uZyBsb25nIGhpID0gMWUxODsKICAgIGxvbmcgbG9uZyBhbnMgPSAwOwogICAgd2hpbGUgKGxvIDw9IGhpKXsKICAgICAgICBsb25nIGxvbmcgbWlkID0gKGxvICsgaGkpIC8gMjsKICAgICAgICBpZiAoY2hlY2sobWlkKSl7CiAgICAgICAgICAgIGFucyA9IG1heChhbnMsIG1pZCk7CiAgICAgICAgICAgIGxvID0gbWlkICsgMTsKICAgICAgICB9CiAgICAgICAgZWxzZSBoaSA9IG1pZCAtIDE7CiAgICB9CiAgICBjb3V0IDw8IGFucyA8PCAnXG4nOwp9Cg==