#include <bits/stdc++.h>
using namespace std;
int k, n;
struct point {
  long long x;
  long long y;
};
point p[10], p1[1009];
vector<pair<pair<pair<long long, long long>, long long>, int> > slopes[10];
vector<vector<int> > targets[10];
int ind[10][1009], ii = 0;
vector<int> per;
bool dead[1009];
stack<int> dd;
bool bt(int i) {
  if (ii >= k) return 0;
  int j = ind[per[ii]][i], jj = per[ii];
  for (int f = 0; f < targets[jj][j].size(); f++) {
    if (targets[jj][j][f] == i) {
      dead[i] = 1;
      dd.push(i);
      return 1;
    }
    if (dead[targets[jj][j][f]]) continue;
    ii++;
    if (!bt(targets[jj][j][f])) return 0;
  }
  assert(0);
}
long long gcd(long long a, long long b) {
  if (b > a) swap(a, b);
  if (!b) return a;
  return gcd(b, a % b);
}
pair<long long, long long> slope(point a, point b) {
  long long x = b.x - a.x;
  long long y = b.y - a.y;
  long long g = gcd(abs(x), abs(y));
  x /= g;
  y /= g;
  return {y, x};
}
long long dist(point a, point b) {
  return (b.x - a.x) * (b.x - a.x) + (b.y - a.y) * (b.y - a.y);
}
int main() {
  clock_t begin_time = clock();
  cin >> k >> n;
  for (int f = 0; f < k; f++) cin >> p[f].x >> p[f].y;
  for (int f = 0; f < n; f++) cin >> p1[f].x >> p1[f].y;
  for (int f = 0; f < k; f++) {
    for (int f1 = 0; f1 < n; f1++) {
      slopes[f].push_back({{slope(p[f], p1[f1]), dist(p[f], p1[f1])}, f1});
    }
    sort(slopes[f].begin(), slopes[f].end());
  }
  vector<int> empt;
  for (int f = 0; f < k; f++) {
    for (int f1 = 0; f1 < slopes[f].size(); f1++) {
      if (!f1 || slopes[f][f1].first.first != slopes[f][f1 - 1].first.first)
        targets[f].push_back(empt);
      targets[f].back().push_back(slopes[f][f1].second);
      ind[f][slopes[f][f1].second] = targets[f].size() - 1;
    }
  }
  int ans = 0;
  for (int f = 0; f < k; f++) per.push_back(f);
  for (int f = 0; f < n; f++) {
    sort(per.begin(), per.end());
    do {
      ii = 0;
      while (dd.size()) {
        dead[dd.top()] = 0;
        dd.pop();
      }
      if (bt(f)) {
        ans++;
        break;
      }
      if (float(clock() - begin_time) / CLOCKS_PER_SEC > 2) break;
    } while (next_permutation(per.begin(), per.end()));
    if (float(clock() - begin_time) / CLOCKS_PER_SEC > 2) break;
  }
  cout << ans << endl;
}
