#include <bits/stdc++.h>
using namespace std;
const int N = 10, M = 1e3 + 10;
int n, m, q[N], ans = 0, t, dt = 0, d[M], v[M];
pair<int, int> a[M], b[M];
vector<int> p[N][M];
bool judge(pair<int, int> a, pair<int, int> b, pair<int, int> c) {
  if (b == c) return 0;
  if (b.first < min(a.first, c.first) || b.first > max(a.first, c.first))
    return 0;
  if (b.second < min(a.second, c.second) || b.second > max(a.second, c.second))
    return 0;
  return 1LL * (b.second - a.second) * (c.first - b.first) ==
         1LL * (b.first - a.first) * (c.second - b.second);
}
bool dfs(int x) {
  if (++t > n) return 0;
  for (int i = 0, j = q[t]; i < p[j][x].size(); i++)
    if (!v[p[j][x][i]])
      if (!dfs(p[j][x][i])) return 0;
  return v[d[++dt] = x] = 1;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].first, &a[i].second);
  for (int i = 1; i <= m; i++) scanf("%d%d", &b[i].first, &b[i].second);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++)
      for (int k = 1; k <= m; k++)
        if (judge(a[i], b[k], b[j])) {
          p[i][j].push_back(k);
          if (p[i][j].size() == n) break;
        }
  for (int i = 1; i <= m; i++) {
    for (int j = 1; j <= n; j++) q[j] = j;
    do {
      while (dt) v[d[dt--]] = 0;
      t = 0;
      if (dfs(i)) {
        ans++;
        break;
      }
    } while (next_permutation(q + 1, q + n + 1));
  }
  printf("%d\n", ans);
  return 0;
}
