#include <bits/stdc++.h>
using namespace std;
const int maxn = 1010, inf = 1e9;
int K, n, st, T, ans, pos;
int tim[maxn], p[maxn], ax[maxn], ay[maxn], mx[maxn], my[maxn], v[maxn];
vector<int> mp[8][maxn];
template <typename T>
inline void read(T &k) {
  int f = 1;
  k = 0;
  char c = getchar();
  while (c < '0' || c > '9') c == '-' && (f = -1), c = getchar();
  while (c <= '9' && c >= '0') k = k * 10 + c - '0', c = getchar();
  k *= f;
}
int check(int s) {
  int x = p[++pos];
  if (pos > K) return 0;
  for (int i = 0; i < mp[x][s].size(); i++)
    if (tim[mp[x][s][i]] != T)
      if (!check(mp[x][s][i])) return 0;
  tim[s] = T;
  return 1;
}
int dfs(int dep) {
  if (dep > K) return ++T, pos = 0, check(st);
  for (int i = 1; i <= K; i++)
    if (!v[i]) {
      p[dep] = i;
      v[i] = 1;
      if (dfs(dep + 1)) return 1;
      v[i] = 0;
    }
  return 0;
}
int main() {
  read(K);
  read(n);
  for (int i = 1; i <= K; i++) read(ax[i]), read(ay[i]);
  for (int i = 1; i <= n; i++) read(mx[i]), read(my[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) {
          int x = mx[j] - ax[i], y = my[j] - ay[i];
          int x2 = mx[k] - ax[i], y2 = my[k] - ay[i];
          if (1ll * x2 * x2 + 1ll * y2 * y2 >= 1ll * x * x + 1ll * y * y &&
              1ll * x * x2 + 1ll * y * y2 >= 0 &&
              1ll * x * y2 == 1ll * x2 * y) {
            mp[i][k].push_back(j);
          }
        }
    }
  }
  for (int i = 1; i <= n; i++) {
    memset(v, 0, sizeof(v));
    st = i, ans += dfs(1);
    memset(v, 0, sizeof(v));
  }
  printf("%d\n", ans);
}
