#include <bits/stdc++.h>
using namespace std;
const int N = 1010, K = 10;
struct P {
  long long x, y;
  P(long long x = 0, long long y = 0) : x(x), y(y) {}
  P operator+(const P& o) const { return P(x + o.x, y + o.y); }
  P operator-(const P& o) const { return P(x - o.x, y - o.y); }
  long long operator*(const P& o) const { return x * o.x + y * o.y; }
  long long operator%(const P& o) const { return x * o.y - y * o.x; }
};
bool chk(const P& p, const P& a, const P& b) {
  if ((p - a) % (b - a)) return false;
  return (p - a) * (p - b) <= 0;
}
P src[K], tar[N];
vector<int> btw[K][N];
int n, k;
int p[K];
bool vis[N], vis2[N];
bool dfs(int t, int& i) {
  if (i >= k) return false;
  int s = p[i];
  for (int j = 0; j < (int(btw[s][t].size())); ++j) {
    if (vis[btw[s][t][j]]) continue;
    if (!dfs(btw[s][t][j], ++i)) return false;
  }
  return vis[t] = vis2[t] = true;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  while (cin >> k >> n) {
    for (int i = 0; i < (k); ++i) cin >> src[i].x >> src[i].y;
    for (int i = 0; i < (n); ++i) cin >> tar[i].x >> tar[i].y;
    for (int i = 0; i < (k); ++i)
      for (int j = 0; j < (n); ++j) {
        btw[i][j].clear();
        for (int k = 0; k < (n); ++k) {
          if (k == j) continue;
          if (chk(tar[k], src[i], tar[j])) {
            btw[i][j].push_back(k);
          }
        }
      }
    memset(vis2, 0, sizeof vis2);
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < (n); ++i) {
      if (vis2[i]) continue;
      for (int j = 0; j < (k); ++j) p[j] = j;
      do {
        memset(vis, 0, sizeof vis);
        int _ = 0;
        if (dfs(i, _)) break;
      } while (next_permutation(p, p + k));
    }
    int ans = 0;
    for (int i = 0; i < (n); ++i)
      if (vis2[i]) ++ans;
    cout << ans << endl;
  }
  return 0;
}
