#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1010;
void read(complex<long long> &p) {
  long long x, y;
  scanf("%lld %lld", &x, &y);
  p = complex<long long>(x, y);
}
bool betw(long long a, long long b, long long c) {
  return min(a, c) <= b && b <= max(a, c);
}
bool coll(complex<long long> p1, complex<long long> p2, complex<long long> p3) {
  p2 -= p1;
  p3 -= p1;
  return p2.real() * p3.imag() == p2.imag() * p3.real() &&
         betw(0, p2.real(), p3.real()) && betw(0, p2.imag(), p3.imag());
}
int N, K;
complex<long long> A[10], P[MAXN];
vector<int> bw[10][MAXN];
int perm[MAXN];
int que[10];
int vis[MAXN], cvis;
int main() {
  scanf("%d %d", &K, &N);
  for (int i = 0; i < K; i++) {
    read(A[i]);
  }
  for (int i = 0; i < N; i++) {
    read(P[i]);
  }
  for (int i = 0; i < K; i++) {
    for (int j = 0; j < N; j++) {
      for (int k = 0; k < N; k++) {
        if (j != k && coll(A[i], P[j], P[k])) {
          bw[i][k].push_back(j);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < N; i++) {
    bool found = false;
    iota(perm, perm + K, 0);
    do {
      bool notfound = false;
      int ql = 0, qr = 0;
      que[qr++] = i;
      vis[i] = cvis++;
      for (int j = 0; j < K; j++) {
        if (ql == qr) {
          break;
        }
        int whit = que[ql++];
        for (int x : bw[perm[j]][whit]) {
          if (vis[x] != cvis) {
            vis[x] = cvis;
            que[qr++] = x;
            if (qr > K) {
              notfound = true;
              break;
            }
          }
        }
        if (notfound) {
          break;
        }
      }
      if (notfound) {
        continue;
      }
      if (ql == qr) {
        found = true;
        break;
      }
    } while (next_permutation(perm, perm + K));
    ans += found;
  }
  printf("%d\n", ans);
}
