#include <bits/stdc++.h>
using namespace std;
const int MaxN = 1010;
struct Point {
  long long x, y;
  friend Point operator-(const Point &a, const Point &b) {
    return (Point){a.x - b.x, a.y - b.y};
  }
  friend Point operator+(const Point &a, const Point &b) {
    return (Point){a.x + b.x, a.y + b.y};
  }
  friend long long operator*(const Point &a, const Point &b) {
    return a.x * b.y - a.y * b.x;
  }
} P[MaxN], S[10];
long long dot(const Point &a, const Point &b) { return a.x * b.x + a.y * b.y; }
vector<int> path[10][MaxN];
int n, k;
Point read() {
  int x, y;
  scanf("%d%d", &x, &y);
  return (Point){x, y};
}
bool on_segment(const Point &x, const Point &a, const Point &b) {
  if ((x - a) * (x - b) != 0) return 0;
  if (a.y == b.y)
    return (x.x) < max(a.x, b.x) && (x.x) > min(a.x, b.x);
  else
    return (x.y) < max(a.y, b.y) && (x.y) > min(a.y, b.y);
}
int key;
int ord[10], otot;
int done[MaxN], dtime;
bool check(int b) {
  if (otot == k) return 0;
  int now = ord[otot];
  ++otot;
  if (!path[now][b].empty())
    for (int i = 0; i <= path[now][b].size() - 1; i++) {
      int x = path[now][b][i];
      if (done[x] != dtime) {
        if (!check(x)) return 0;
      }
    }
  done[b] = dtime;
  return 1;
}
bool dfs(int now) {
  static int vis[10];
  if (now == k) {
    ++dtime;
    otot = 0;
    return check(key);
  }
  bool ret = 0;
  for (int i = 0; i < k && !ret; ++i)
    if (!vis[i]) {
      ord[now] = i;
      vis[i] = 1;
      ret |= dfs(now + 1);
      vis[i] = 0;
    }
  return ret;
}
bool afraid(int p) {
  key = p;
  return dfs(0);
}
int main() {
  scanf("%d%d", &k, &n);
  for (int i = 0; i < k; ++i) S[i] = read();
  for (int i = 0; i < n; ++i) P[i] = read();
  for (int i = 0; i < k; ++i)
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k)
        if (on_segment(P[k], S[i], P[j])) path[i][j].push_back(k);
    }
  int ans = 0;
  for (int i = 0; i < n; ++i)
    if (afraid(i)) ++ans;
  cout << ans << endl;
  return 0;
}
