#include <bits/stdc++.h>
using namespace std;
inline int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m, now, ans, q[1005], avis[10], bvis[1005], num[1005][1005],
    line[10][1005][1005];
struct data {
  int x, y, z;
} a[10], b[1005];
bool same(data a, data b, data c) {
  if (a.x == b.x && b.x == c.x) {
    if ((a.y < b.y && b.y < c.y) || (a.y > b.y && b.y > c.y))
      return 1;
    else
      return 0;
  }
  if (a.y == b.y && b.y == c.y) {
    if ((a.x < b.x && b.x < c.x) || (a.x > b.x && b.x > c.x))
      return 1;
    else
      return 0;
  }
  if (a.x < b.x && b.x < c.x || (a.x > b.x && b.x > c.x)) {
    if ((a.y < b.y && b.y < c.y) || (a.y > b.y && b.y > c.y)) {
      if (1.0 * (b.y - a.y) / (b.x - a.x) == 1.0 * (c.y - b.y) / (c.x - b.x))
        return 1;
    } else
      return 0;
  }
  return 0;
}
int dfs() {
  if (now > q[0]) return 1;
  int u = q[now], tmp = q[0];
  for (int i = 1; i <= n; ++i)
    if (!avis[i] && num[i][u] >= 0) {
      avis[i] = 1;
      int ok = 1;
      for (int j = 1; j <= num[i][u]; ++j) {
        if (!bvis[line[i][u][j]]) {
          if (q[0] + 1 > n) {
            ok = 0;
            break;
          }
          q[++q[0]] = line[i][u][j];
          bvis[line[i][u][j]] = 1;
        }
      }
      if (!ok) {
        for (int j = tmp + 1; j <= q[0]; ++j) bvis[q[j]] = 0;
        avis[i] = 0;
        q[0] = tmp;
        continue;
      }
      ++now;
      ok = dfs();
      --now;
      for (int j = tmp + 1; j <= q[0]; ++j) bvis[q[j]] = 0;
      avis[i] = 0;
      q[0] = tmp;
      if (ok) return 1;
    }
  return 0;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= n; ++i) a[i].x = read(), a[i].y = read();
  for (int i = 1; i <= m; ++i) b[i].x = read(), b[i].y = read();
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j) {
      for (int k = 1; k <= m; ++k)
        if (same(a[i], b[k], b[j])) line[i][j][++num[i][j]] = k;
      if (num[i][j] >= m) num[i][j] = -1;
    }
  for (int i = 1; i <= m; ++i) {
    q[0] = now = 1;
    q[1] = i;
    bvis[i] = 1;
    ans += dfs();
    bvis[i] = 0;
  }
  printf("%d", ans);
}
