#include <bits/stdc++.h>
using namespace std;
struct SPt {
  int x, y;
  SPt() {}
  SPt(int X, int Y) {
    x = X;
    y = Y;
  }
};
SPt operator-(const SPt &a, const SPt &b) { return SPt(a.x - b.x, a.y - b.y); }
long long operator*(const SPt &a, const SPt &b) {
  return 1ll * a.x * b.y - 1ll * a.y * b.x;
}
SPt A[10], B[1010];
vector<int> ve[10][1010];
bool qj(int a, int b, int c) { return (a < c && c < b) || (b < c && c < a); }
bool zhang(SPt a, SPt b, SPt c) {
  if ((b - a) * (c - a)) return false;
  return qj(a.x, b.x, c.x) || qj(a.y, b.y, c.y);
}
int pl[5050][8], sl = 0;
void dfs(int n, int i, int sz[10], bool bk[10]) {
  if (i == n) {
    for (int j = 0; j < n; j++) pl[sl][j] = sz[j];
    sl += 1;
    return;
  }
  for (int j = 0; j < n; j++) {
    if (bk[j]) continue;
    bk[j] = true;
    sz[i] = j;
    dfs(n, i + 1, sz, bk);
    bk[j] = false;
  }
}
int dl[100010];
bool bk[1010];
int main() {
  int k, n;
  scanf("%d%d", &k, &n);
  for (int i = 0; i < k; i++) scanf("%d%d", &A[i].x, &A[i].y);
  for (int i = 0; i < n; i++) scanf("%d%d", &B[i].x, &B[i].y);
  for (int i = 0; i < k; i++) {
    for (int j = 0; j < n; j++) {
      for (int a = 0; a < n; a++) {
        if (a != j && zhang(A[i], B[j], B[a]) && ve[i][j].size() <= 7)
          ve[i][j].push_back(a);
      }
    }
  }
  int ds[10], ans = 0;
  bool db[10] = {0};
  dfs(k, 0, ds, db);
  for (int a = 0; a < n; a++) {
    bool sc = false;
    for (int p = 0; p < sl; p++) {
      int he = 0, ta = 1;
      dl[0] = a;
      bk[a] = true;
      while (he < ta) {
        if (he >= k) break;
        int u = dl[he], z = pl[p][he];
        he += 1;
        for (int s = 0; s < ve[z][u].size(); s++) {
          int t = ve[z][u][s];
          if (!bk[t]) bk[t] = true, dl[ta++] = t;
        }
      }
      for (int i = 0; i < ta; i++) bk[dl[i]] = false;
      if (he == ta) {
        sc = true;
        break;
      }
    }
    if (sc) ans += 1;
  }
  printf("%d", ans);
  return 0;
}
