#include <bits/stdc++.h>
using namespace std;
long long cross(complex<long long> a, complex<long long> b) {
  return a.real() * b.imag() - a.imag() * b.real();
}
struct line {
  complex<long long> v;
  long long c;
  line(complex<long long> p, complex<long long> q) {
    v = q - p;
    c = cross(v, p);
  }
  long double get_x() { return -c * 1.0L / v.imag(); }
  long long side(complex<long long> p) { return cross(v, p) - c; }
};
long long n, m;
const long long N = 1e6 + 100;
long long ans[N];
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m;
  vector<complex<long long> > p(m);
  for (long long i = 0; i < m; i++) {
    long long X, Y;
    cin >> X >> Y;
    p[i] = complex<long long>(X, Y);
  }
  vector<line> l;
  for (long long i = 0; i < m; i++) {
    for (long long j = i + 1; j < m; j++) {
      line l2(p[i], p[j]);
      if (abs(l2.get_x() - round(l2.get_x())) < 1e-9) {
        long long xxx = round(l2.get_x());
        if (0 < xxx && xxx <= n) l.push_back(l2);
      }
    }
  }
  for (long long i = 1; i <= n; i++) {
    ans[i] = 1;
  }
  for (auto &el : l) {
    long long cnt = 0;
    for (long long i = 0; i < m; i++) {
      if (el.side(p[i]) == 0) cnt++;
    }
    long long xxx = round(el.get_x());
    ans[xxx] = max(ans[xxx], cnt);
  }
  long long ansans = 0;
  for (long long i = 1; i <= n; i++) {
    ansans += ans[i];
  }
  cout << ansans << "\n";
}
