#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<string>
#include<stack>
#include<queue>
#include<string.h>
#include<array>
#include<algorithm>
#include<cmath>
using namespace std;
#define ff first
#define ss second
#define endl '\n'
const int maxn = 5e5;
const long long oo = 1e18;
int maxq = 29;
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int l, n;
cin >> l >> n;
vector<pair<int, int>> t;
for(int i = 0; i < n; i++){
int u, v;
cin >> u >> v;
t.push_back({u, v});
}
sort(t.begin(), t.end());
vector<int> dp(n, 1);
for(int i = 0; i < n; i++){
for(int j = i + 1; j < n; j++){
if((l / t[j].ss + t[j].ff) < (l / t[i].ss + t[i].ff)){
dp[j] = max(dp[j], dp[i] + 1);
}
}
}
cout << dp[n - 1];
}