#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:33554432")
using namespace std;
const double PI = 2 * acos(0.0);
const double EPS = 1e-8;
const int INF = (1 << 30) - 1;
struct intP {
  long long x, y;
  intP(long long x = 0, long long y = 0) {
    this->x = x;
    this->y = y;
  }
};
int n, m;
intP p[300];
int maxans[1000000];
long long pssc(intP& a, intP& b, intP& c) {
  return (b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y);
}
int getInter(intP a, intP b) {
  if (a.y == b.y) return -1;
  if (a.y > b.y) swap(a, b);
  if (a.x == b.x) {
    if (a.x > 0 && a.x <= n)
      return a.x;
    else
      return -1;
  }
  double rx = double(a.x) + double(a.x - b.x) / double(b.y - a.y) * a.y;
  if (rx < 0 || rx > n + 1) return -1;
  intP res = intP(int(floor(rx + 0.5)), 0);
  if (pssc(a, b, res) == 0)
    return res.x;
  else
    return -1;
}
int count(intP& a, intP& b) {
  int res = 0;
  for (int i = 0; i < m; ++i)
    if (pssc(a, b, p[i]) == 0) ++res;
  return res;
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i) maxans[i] = 1;
  for (int i = 0; i < m; ++i) cin >> p[i].x >> p[i].y;
  for (int i = 0; i < m - 1; ++i) {
    for (int j = i + 1; j < m; ++j) {
      long long x = getInter(p[i], p[j]);
      if (x >= 1 && x <= n)
        maxans[x - 1] = (maxans[x - 1] > count(p[i], p[j]) ? maxans[x - 1]
                                                           : count(p[i], p[j]));
    }
  }
  long long ans = 0;
  for (int i = 0; i < n; ++i) ans += maxans[i];
  cout << ans;
  return 0;
};
