#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-9, PI = acos(-1.0);
const long long INF = 1LL << 60;
struct P {
  long long x, y;
  P() {}
  P(long long x, long long y) : x(x), y(y) {}
  void eat() {
    cin >> x >> y;
    ;
  }
  P operator+(const P &p) const { return P(x + p.x, y + p.y); }
  P operator-(const P &p) const { return P(x - p.x, y - p.y); }
  P operator*(double k) { return P(x * k, y * k); }
  long long operator*(P p) { return x * p.x + y * p.y; }
  long long operator^(P p) { return x * p.y - y * p.x; }
  double mag2() { return x * x + y * y; }
  double mag() { return sqrt(mag2()); }
  bool operator<(const P &p) const {
    if ((fabs((x) - (p.x)) < EPS)) return ((y) < (p.y) - EPS);
    return ((x) < (p.x) - EPS);
  }
  bool operator==(const P &p) const {
    return (fabs((x) - (p.x)) < EPS) && (fabs((y) - (p.y)) < EPS);
  }
  P rot() { return P(-y, x); }
  P rot(double the) {
    return P(x * cos(the) - y * sin(the), x * sin(the) + y * cos(the));
  }
  P nor() {
    if ((fabs((mag()) - (0)) < EPS)) return *this;
    return *this * (1. / mag());
  }
  P ref(P n) {
    n = n.nor();
    return n * (n * (*this)) * 2 - *this;
  }
  void prt() { printf("(%lld,%lld)\n", x, y); }
} st[10], mon[2010];
int n, m, p[10], a[2010];
vector<int> ost[2010][10];
int btw(P &a, P &b, P &c) {
  P d = b - a, e = c - a;
  long long tmp = d ^ e;
  if (tmp) return 0;
  d = b - a;
  e = c - b;
  if (d.x * e.x < 0) return 0;
  if (d.y * e.y < 0) return 0;
  return 1;
}
int vis[10];
int main() {
  cin >> m >> n;
  for (int i = (0); i < (m); i++) st[i].eat();
  for (int i = (0); i < (n); i++) mon[i].eat();
  for (int i = (0); i < (n); i++)
    for (int j = (0); j < (n); j++) {
      if (i == j) continue;
      for (int k = (0); k < (m); k++) {
        if (btw(st[k], mon[j], mon[i])) ost[i][k].push_back(j);
      }
    }
  for (int i = (0); i < (n); i++) {
    if (a[i]) continue;
    for (int j = (0); j < (m); j++) p[j] = j;
    do {
      if (a[i]) break;
      vector<int> v;
      v.push_back(i);
      for (int j = (0); j < (m); j++) {
        if (j >= (int)v.size()) break;
        for (auto x : ost[v[j]][p[j]]) {
          if (v.size() > m) break;
          auto it = find(v.begin(), v.end(), x);
          if (it == v.end()) v.push_back(x);
        }
        if (v.size() > m) break;
      }
      if ((int)v.size() > m) continue;
      for (auto x : v) a[x] = 1;
      break;
      memset(vis, 0, sizeof(vis));
      while (1) {
        int ok = 0;
        for (int j = (0); j < ((int)v.size()); j++) {
          if (vis[j]) continue;
          int can_vis = 1;
          for (auto x : ost[v[j]][p[j]]) {
            int tmp = find(v.begin(), v.end(), x) - v.begin();
            if (!vis[tmp]) can_vis = 0;
          }
          if (can_vis) {
            vis[j] = 1;
            a[v[j]] = 1;
            ok = 1;
          }
        }
        if (!ok) break;
      }
    } while (next_permutation(p, p + m));
  }
  int ans = 0;
  for (int i = (0); i < (n); i++)
    if (a[i]) ans += 1;
  cout << ans << '\n';
  return 0;
}
