#include <bits/stdc++.h>
using namespace std;
using LL = long long;
void err() { cout << "\033[39;0m" << endl; }
template <typename T, typename... A>
void err(T a, A... x) {
  cout << a << ' ';
  err(x...);
}
template <template <typename...> class T, typename t, typename... A>
void err(T<t> u, A... x) {
  for (auto v : u) cout << v << ' ';
  err(x...);
}
struct P {
  LL x, y;
};
P operator-(const P& a, const P& b) { return {a.x - b.x, a.y - b.y}; }
LL det(const P& a, const P& b) { return a.x * b.y - a.y * b.x; }
LL dot(const P& a, const P& b) { return a.x * b.x + a.y * b.y; }
const int N = 1E3 + 100, K = 8;
P a[N], m[N];
vector<int> barrier[K][N];
int used[N], ok[N];
int main() {
  int k, n;
  cin >> k >> n;
  for (decay<decltype(k)>::type i = (0), _i = k; i < _i; ++i)
    scanf("%lld%lld", &a[i].x, &a[i].y);
  for (decay<decltype(n)>::type i = (0), _i = n; i < _i; ++i)
    scanf("%lld%lld", &m[i].x, &m[i].y);
  for (decay<decltype(k)>::type i = (0), _i = k; i < _i; ++i)
    for (decay<decltype(n)>::type u = (0), _u = n; u < _u; ++u)
      for (decay<decltype(n)>::type v = (0), _v = n; v < _v; ++v) {
        if (u == v) continue;
        if (det(m[u] - a[i], m[v] - a[i]) == 0 &&
            dot(a[i] - m[v], m[u] - m[v]) < 0) {
          barrier[i][u].push_back(v);
          ;
          if (barrier[i][u].size() >= K) break;
        }
      }
  for (decay<decltype(n)>::type x = (0), _x = n; x < _x; ++x) {
    vector<int> orders(k);
    iota(orders.begin(), orders.end(), 0);
    do {
      vector<int> clean;
      queue<int> q;
      q.push(x);
      used[x] = 1;
      clean.push_back(x);
      for (int p : orders) {
        if (q.empty()) break;
        int t = q.front();
        q.pop();
        for (int y : barrier[p][t])
          if (!used[y]) {
            q.push(y);
            used[y] = 1;
            clean.push_back(y);
          }
        if (clean.size() >= K) break;
      }
      if (q.empty()) ok[x] = 1;
      for (int t : clean) used[t] = 0;
    } while (next_permutation(orders.begin(), orders.end()));
    ;
  }
  cout << accumulate(ok, ok + n, 0) << endl;
}
