#include<bits/stdc++.h>
#define N 110
using namespace std;
typedef long long ll;
struct rec
{
int k,f;
};
rec a[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin >> n >> m;
for (int i=1;i<=m;i++)
cin >> a[i].k >> a[i].f;
for (int i=1;i<=m;i++)
{
for (int j=1;j<=m;j++)
{
if (a[j].f+1==a[i].f && a[j].k+1==a[i].k)
{
int l = a[j].k/a[j].f;
if (n%l==0) cout << n/l << endl;
else cout << n/l+1 << endl;
return 0;
}
if (a[j].f-1==a[i].f && a[j].k-1==a[i].k)
{
int l = a[i].k/a[i].f;
if (n%l==0) cout << n/l << endl;
else cout << n/l+1 << endl;
return 0;
}
}
}
cout << -1 << endl;
return 0;
}
问亿下我怎么错了