#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point() {}
  point(int a, int b) {
    x = a;
    y = b;
  }
};
inline int direction(point &pi, point &pj, point &pk) {
  return (pk.x - pi.x) * (pj.y - pi.y) - (pj.x - pi.x) * (pk.y - pi.y);
}
int x[1000001], y[1000001];
int vis[1000001] = {0};
int count = 0;
int n, m;
int sum = 0;
void find(int i, int j) {
  double ans;
  point a, b, c;
  if (x[i] - x[j] != 0) {
    double rx =
        (double)x[i] + (double)(x[i] - x[j]) / (double)(y[j] - y[i]) * y[i];
    ans = floor(rx + 0.5);
  } else {
    ans = x[i];
  }
  int e = ans;
  if (e < 1 || e > n) return;
  point aa(x[i], y[i]), bb(x[j], y[j]), cc(e, 0);
  if (direction(aa, bb, cc) != 0) return;
  int sum1 = 0;
  for (int k = 0; k < m; k++) {
    a.x = x[i];
    a.y = y[i];
    b.x = x[j];
    b.y = y[j];
    c.x = x[k];
    c.y = y[k];
    if (direction(a, b, c) == 0) sum1++;
  }
  if (sum1 > vis[e]) {
    vis[e] = sum1;
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d%d", &x[i], &y[i]);
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < m; j++) {
      if (i == j) continue;
      find(i, j);
    }
  }
  for (int i = 1; i <= n; i++) {
    if (vis[i] == 0)
      sum++;
    else
      sum += vis[i];
  }
  printf("%d", sum);
  return 0;
}
