#include <bits/stdc++.h>
using namespace std;
int n, m, x[251], y[251], c[1000005];
int mcd(int a, int b) {
  int tmp;
  while (b != 0) {
    tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> x[i] >> y[i];
  for (int i = 1; i <= n; i++) c[i] = 1;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      int dx = x[j] - x[i], dy = y[j] - y[i],
          md = mcd(((dx) > 0 ? (dx) : -(dx)), ((dy) > 0 ? (dy) : -(dy)));
      if (md == 0) continue;
      dx /= md, dy /= md;
      int cnt = 0;
      for (int k = 0; k < m; k++) {
        if ((long long)dy * (x[k] - x[i]) == (long long)dx * (y[k] - y[i]))
          cnt++;
      }
      if (dy != 0 && ((long long)dx * y[i]) % dy == 0) {
        long long px = x[i] - (long long)y[i] * dx / dy;
        if (px >= 1 && px <= n) c[px] = max(c[px], cnt);
      }
    }
  }
  long long ret = 0LL;
  for (int i = 1; i <= n; i++) ret += c[i];
  cout << ret << endl;
  return 0;
}
