#include <bits/stdc++.h>
using namespace std;
struct Segment {
  pair<long long, long long> a, b;
  Segment(const pair<long long, long long>& a,
          const pair<long long, long long>& b)
      : a(a), b(b) {}
  bool hasPoint(const pair<long long, long long>& point) const {
    if (point == a || point == b) return true;
    return (point.first >= min(a.first, b.first) &&
            point.first <= max(a.first, b.first) &&
            point.second >= min(a.second, b.second) &&
            point.second <= max(a.second, b.second) &&
            abs((point.first - a.first) * (point.second - b.second) ==
                (point.first - b.first) * (point.second - a.second)));
  }
};
const int MAXN = 1000;
const int MAXK = 7;
int k, n, u, v, per[MAXK], res, cnt, ind;
pair<long long, long long> stones[MAXK], monsters[MAXN];
vector<int> mids[MAXK][MAXN];
queue<int> que;
bool check, fr[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> k >> n;
  for (int kk = 0; kk < k; ++kk) {
    cin >> u >> v;
    stones[kk] = pair<long long, long long>(u, v);
  }
  for (int i = 0; i < n; ++i) {
    cin >> u >> v;
    monsters[i] = pair<long long, long long>(u, v);
  }
  for (int kk = 0; kk < k; ++kk)
    for (int i = 0; i < n; ++i) {
      Segment seg(stones[kk], monsters[i]);
      for (int j = 0; j < n; ++j)
        if (j != i && seg.hasPoint(monsters[j])) mids[kk][i].push_back(j);
    }
  for (int i = 0; i < n; ++i) {
    for (int kk = 0; kk < k; ++kk) per[kk] = kk;
    check = false;
    do {
      memset(fr, false, n);
      ind = 0;
      while (!que.empty()) que.pop();
      que.push(i);
      cnt = 1;
      fr[i] = true;
      while (!que.empty()) {
        u = que.front();
        que.pop();
        for (int mid : mids[per[ind]][u])
          if (!fr[mid]) {
            que.push(mid);
            fr[mid] = true;
            if (++cnt > k) goto LABEL;
          }
        ++ind;
      }
    LABEL:
      if (que.empty()) {
        check = true;
        break;
      }
    } while (next_permutation(per, per + k));
    res += check;
  }
  cout << res;
  return 0;
}
