#include <bits/stdc++.h>
const int MAXN = 1010;
const int INF = 0x3f3f3f3f;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
struct Point {
  long long x, y;
  Point() { x = y = 0; }
  Point(long long a, long long b) { x = a, y = b; }
  long long operator^(Point b) const { return x * b.y - y * b.x; }
  long long operator*(Point b) const { return x * b.x + y * b.y; }
  long long length() const { return x * x + y * y; }
  long double slen() const { return sqrt(x * x + y * y); }
  Point operator-(Point b) const { return Point(x - b.x, y - b.y); }
  Point operator+(Point b) const { return Point(x + b.x, y + b.y); }
  Point operator*(long double k) const { return Point(x * k, y * k); }
  friend std::istream& operator>>(std::istream& in, Point& x) {
    in >> x.x >> x.y;
    return in;
  }
  friend std::ostream& operator<<(std::ostream& out, Point& x) {
    out << '(' << x.x << ',' << x.y << ')';
    return out;
  }
  bool operator<(Point b) const { return x == b.x ? y < b.y : x < b.x; }
  Point slope() const {
    if (!x && !y) return *this;
    long long g = gcd(x, y);
    Point res = *this;
    if (g < 0) g = -g;
    res.x /= g, res.y /= g;
    return res;
  }
  bool isinf() { return x == INF; }
} ps[MAXN], ks[10];
const Point del(INF, INF);
int K, n;
std::vector<int> to[8][MAXN];
bool vis[10], killed[MAXN], inn[10][MAXN];
bool dfs(int S, std::vector<int> li) {
  if (!li.size()) return true;
  if (S == 0) return false;
  int tar = li.back();
  bool* ins = inn[S];
  for (auto t : li) ins[t] = true;
  bool Res = false;
  for (int i = 1; i <= K; ++i)
    if (!vis[i]) {
      bool can = true;
      int tsz = li.size();
      std::vector<int> tl;
      for (auto t : to[i][tar])
        if (!killed[t]) {
          tsz += !ins[t];
          if (tsz > S + 1) {
            can = false;
            break;
          }
          if (!ins[t]) tl.push_back(t);
        }
      if (!can) continue;
      killed[tar] = true;
      vis[i] = true;
      std::vector<int> tv;
      for (auto t : li)
        if (!killed[t]) tv.push_back(t);
      for (auto t : tl)
        if (!killed[t]) tv.push_back(t);
      bool rt = dfs(S - 1, tv);
      killed[tar] = false;
      vis[i] = false;
      if (rt) {
        Res = true;
        break;
      }
    }
  for (auto t : li) ins[t] = false;
  return Res;
}
int main() {
  std::ios_base::sync_with_stdio(false), std::cin.tie(0);
  std::cin >> K >> n;
  for (int i = 1; i <= K; ++i) std::cin >> ks[i];
  for (int i = 1; i <= n; ++i) std::cin >> ps[i];
  for (int i = 1; i <= K; ++i)
    for (int j = 1; j <= n; ++j)
      for (int k = 1; k <= n; ++k)
        if (j != k && !((ps[k] - ps[j]) ^ (ks[i] - ps[k])))
          if (fabsl((ks[i] - ps[j]).slen() + (ps[j] - ps[k]).slen() -
                    (ks[i] - ps[k]).slen()) < 1e-6)
            to[i][k].push_back(j);
  for (int i = 1; i <= K; ++i)
    for (int j = 1; j <= n; ++j)
      std::sort(to[i][j].begin(), to[i][j].end(), [i](int a, int b) {
        return (ps[a] - ks[i]).length() < (ps[b] - ks[i]).length();
      });
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += dfs(K, std::vector<int>(1, i));
  std::cout << ans << std::endl;
  return 0;
}
