#include <bits/stdc++.h>
using namespace std;
long long n, k, tot, clck, ans;
long long x[1003], y[1003], X[10], Y[10], r[1003], vis[1003];
vector<long long> v[8][1003];
inline long long get(long long x) {
  if (x > 0) {
    return 1;
  } else if (x < 0) {
    return -1;
  } else {
    return 0;
  }
}
inline bool in(long long i, long long j, long long k) {
  long long a = x[j] - X[i], b = y[j] - Y[i], c = x[k] - X[i], d = y[k] - Y[i];
  if ((get(a) != get(c)) || (get(b) != get(d))) {
    return 0;
  }
  if ((abs(a) > abs(c)) || (abs(b) > abs(d))) {
    return 0;
  }
  return a * d == b * c;
}
bool dfs(long long x) {
  if (tot > k) {
    return 0;
  }
  long long now = r[tot++];
  for (long long i = 0; i < v[now][x].size(); i++) {
    long long to = v[now][x][i];
    if (vis[to] != clck && !dfs(to)) {
      return 0;
    }
  }
  vis[x] = clck;
  return 1;
}
int main() {
  cin >> k >> n;
  for (int i = 1; i <= k; i++) {
    cin >> X[i] >> Y[i];
  }
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> y[i];
  }
  for (int i = 1; i <= k; i++) {
    for (int j = 1; j <= n; j++) {
      for (int kk = 1; kk <= n; kk++) {
        if (j != kk && in(i, kk, j)) {
          v[i][j].push_back(kk);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= k; j++) {
      r[j] = j;
    }
    do {
      ++clck;
      tot = 1;
      if (dfs(i)) {
        ans++;
        break;
      }
    } while (next_permutation(r + 1, r + k + 1));
  }
  cout << ans << endl;
  return 0;
}
