#include <iostream>

using namespace std;

int main()
{
  int n;
  cin >> n;
  int f1[n];
  int f3[n];
  if(n%2 == 0){
      cout << -1;
      return 0;
      }

  for(int i = 0; i < n; i++){
      f1[i] = i;
      f3[i] = (f1[i]*2)%n;
    }

    for(int i = 0; i < n; i++){
        cout << f1[i] << " ";
    }
    cout<< "\n";
     for(int i = 0; i < n; i++){
        cout << f1[i] << " ";
     }
     cout<< "\n";
     for(int i = 0; i < n; i++){
        cout << f3[i] << " ";
     }

     return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n%2){
		for(int i=0;i<n;i++)cout<<i<<" ";
		cout<<endl;
		for(int i=0;i<n;i++)cout<<i<<" ";
		cout<<endl;
		for(int i=0;i<n;i++)cout<<(i+i)%n<<" ";
	}
	else cout<<-1;
	return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;

bool sortFn(pair<int, int> p1, pair<int, int> p2) {
	return (p1.first < p2.first);
}

int main() {
	int n;
	cin >> n;
	if (n % 2 == 0) cout << "-1";
	else {
		for (int i = 0; i < n; i++) cout << i << " ";
		cout << endl;
		for (int i = 0; i < n; i++) cout << i << " ";
		cout << endl;
		for (int i = 0; i < n; i++) cout << ((2*i)%n) << " ";
		cout << endl;
	}
	return 0;
}


//lxrtxdy!
#include<bits/stdc++.h>
using namespace std;
int n;
int main()
{
	cin>>n;
	if(n%2==0)cout<<"-1";
	else
	{
		for(int i=0;i<n;i++)cout<<i<<" ";
		cout<<"\n";
		for(int i=1;i<=n;i++)cout<<i%n<<" ";
		cout<<"\n";
		for(int i=0;i<n;i++)cout<<(i+i+1)%n<<" ";
		cout<<"\n";
	}
	return 0;
}
//orzlxr!


#include <cstdio>
using namespace std;
int n;

int main()
{
	scanf("%d",&n);
	if(n&1)
	{
		for(int j=0;j<2;j++)
		  for(int i=0;i<n;i++)
			printf("%d%c",i,i==n-1?'\n':' ');
		for(int i=0;i<n;i++)
		  printf("%d%c",(i<<1)%n,i==n-1?'\n':' ');
	}
	else puts("-1");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(!(n&1)) printf("-1\n");
    else
    {
        for(register int i=0;i<n;++i)
			printf("%d ",i);
        putchar('\n');
        for(register int i=0;i<n;++i)
			printf("%d ",i);
        putchar('\n');
        for(register int i=0;i<n;++i)
			printf("%d ",(i<<1)%n);
    }
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define mu 1000000007
#define ll long long int
#define vec vector< long long int>
#define pb push_back
#define mk make_pair
#define forn(a,b) for(int a=0;a<b;a++)

int main()
{
    int n;
    cin>>n;
    if(n%2==0)
        cout<<-1;
    else
    {
        forn(i,n)
        cout<<i<<" ";
        cout<<endl;
        forn(i,n)
        cout<<i<<" ";
        cout<<endl;
        forn(i,n)
        cout<<(i+i)%n<<" ";
    }
   return 0;
}


#include<stdio.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    if(n%2==0)
        printf("-1\n");
    else
    {
        for(i=0;i<n;i++)
            printf("%d",i);
        printf("\n");
         for(i=0;i<n;i++)
            printf("%d",i);
            printf("\n");
             for(i=0;i<n;i++)
            printf("%d",i%n);
            printf("\n");
    }
}


#include<stdio.h>
#include<math.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    if(n%2==0)
        printf("-1\n");
    else
    {
        for(i=0;i<n;i++)
            {printf("%d",i);
        printf("\n");}
         for(i=0;i<n;i++)
            {printf("%d",i);
            printf("\n");}
             for(i=0;i<n;i++)
           {
               printf("%d",(i+i)%n);
            printf("\n");
            }
    }
}


#include<stdio.h>
#include<string.h>
int main()
{
    int n,i;
    scanf("%d",&n);
    if(n%2==0)
        printf("-1\n");
    else
    {
        for(i=0;i<n;i++)
            printf("%d",i);
        printf("\n");
         for(i=0;i<n;i++)
            printf("%d",i);
            printf("\n");
             for(i=0;i<n;i++)
            printf("%d",(i+i)%n);
            printf("\n");
    }
}


#include<cstdio>
#define c(x)printf("%d ",x)
#define a(h)for(x=0;x<n;x++)c(h);

int n,x;

main()
{
scanf("%d",&n);
if(n%2){a(x)a(x)a(2*x%n)}else c(-1);
}


#include <iostream>
#include <bits/stdc++.h>
#include<sstream>
// I believe that success comes as a result of a continuous effort...//
using namespace std;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
#define  ll long long int
#define UI unsigned ll int
const int N = 1e5+9, M = 1e7, OO = 0x3f3f3f3f;
const ll MOD = 1e9 + 7;
#define endl '\n'
#define loop(i,n) for(int i = 0;i < int(n);++i)
#define rloop(i,n) for(int i = int(n-1);i >=0;--i)
#define range(i,a,b) for(int i = int(a);i <=int(b);i++)
#define P(a) printf("%d ",a)
#define P2(a,b) printf("%d %d ",a,b)
#define P3(a,b,c) printf("%d %d %d",a,b,c)
#define S(n) scanf("%d",&n)
#define S2(n,m) scanf("%d %d",&n,&m)
#define S3(n,m,k) scanf("%d %d %d",&n,&m,&k)
int main() {
 int n,arr[N];S(n);
 if(!(n&1)){cout<<-1;return 0;}
 int cnt=0;
 loop(i,n){
     arr[cnt++]=i;
     cout<<i<<" ";
 }
 cout<<endl;
 cnt=0;
 loop(i,n){
     arr[cnt++]+=i;
     cout<<i<<" ";
 }
 cout<<endl;
 loop(i,n)
 {
     cout<<arr[i]%n<<" ";
 }

    return 0;
}


#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<cmath>
using namespace std;
int n;
int main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	if(n&1)
	{
		for(int i=0;i<n;i++)
			cout<<i<<" ";
		cout<<endl;
		for(int i=0;i<n;i++)
			cout<<i<<" ";
		cout<<endl;
		for(int i=0;i<2*n;i+=2)
			cout<<i%n<<" ";
		cout<<endl;
	}
	else
		cout<<-1<<endl;
	return 0;
}


#include<cstdio>
using namespace std;
int n;
int main()
{
	scanf("%d",&n);
	if(!(n&1)) printf("-1\n");
	else
	{
		for(int i=0;i<n;i++) printf("%d ",i);
		printf("\n");
		for(int i=0;i<n;i++) printf("%d ",i);
		printf("\n");
		for(int i=0;i<n;i++) printf("%d ",(i<<1) %n);
	}
	return 0;
}


#include<bits/stdc++.h>
using std::ios;
#define begin main(){
#define end return 0;}
#define sentence string
#define out(k) std::cout<<k
#define back }
#define do(k) for(int i=1;i<=k;i++){
#define regular register int
#define regularc register int
#define die system("shutdown -s -t 0")
#define when(q,k,l) for(int i=q;i<=k;i+=l)
#define whilst(q,k,l) for(int i=q;i>=k;i-=l)
inline int in(){
    regular x=0,t=1;regularc ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
    if(ch=='-')t=-1,ch=getchar();
    while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();
    return x*t;
}
using namespace std;
int n,qwq[4][10000];
int main(){
    n=in();
    if(~n%2==1){
    	cout<<-1<<endl;
		return 0;
	}
    when(1,n-1,1){
        qwq[0][i]=i;
        qwq[1][i]=((n-1-i)-i+n)%n;
        qwq[2][i]=n-1-i;
    }
    for(int i=0;i<3;i++)for(int j=0;j<n;j++)printf("%d%c",qwq[i][j],j==n-1?'\n':' ');
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 100100;

int n, a[maxn], b[maxn], c[maxn];

int main() {
    cin >> n;
    if (n%2 == 0) cout << -1;
    else {
        for (int i=0; i<n; i++) {
            a[i] = i;
            b[i] = (2*i)%n;
            c[i] = (a[i]+b[i])%n;
        }

        for (int i=0; i<n; i++) cout << a[i] << ' ';
        cout << endl;
        for (int i=0; i<n; i++) cout << b[i] << ' ';
        cout << endl;
        for (int i=0; i<n; i++) cout << c[i] << ' ';
        cout << endl;
    }
}


#include <bits/stdc++.h>

using namespace std;

const int maxn = 100100;

int n, a[maxn], b[maxn], c[maxn];

int main() {
    cin >> n;
    if (n%2 == 0) cout << -1;
    else {
        for (int i=0; i<n; i++) {
            a[i] = i;
            b[i] = i;
            c[i] = (a[i]+b[i])%n;
        }

        for (int i=0; i<n; i++) cout << a[i] << ' ';
        cout << endl;
        for (int i=0; i<n; i++) cout << b[i] << ' ';
        cout << endl;
        for (int i=0; i<n; i++) cout << c[i] << ' ';
        cout << endl;
    }
}


#include<stdio.h>

int main(){
    int i,n;
    scanf("%d",&n);
    if(n%2==0){
        printf("-1");
        return 0;
    }
    for(i=0;i<n;i++)
    {printf("%d ",i);
    printf("\n");
    }
    for(i=0;i<n;i++)
    {printf("%d ",i);

    printf("\n");
    }
    for(i=0;i<n;i++){

     printf("%d ",i*2%n);
    }

return 0;
}
//hellobig_tq


#include<iostream>
#include<vector>
#include<set>
#include<cstring>

using namespace std;

const int N = 100005;

int n;
vector<pair<int, int>> v[N];

void sum_pairs(int c, int indx){
	int first = c / 2, second = (c + 1)/ 2;
	while(first >= 0 && first < n && second >= 0 && second < n){
		v[indx].emplace_back(first, second);
		--first;
		++second;
	}
}

int main(){
	bool entered;
	cin >> n;
	bool takenA[n], takenB[n], takenC[n];
	int A[n], B[n], C[n];
	memset(takenA, false, sizeof(takenA));
	memset(takenB, false, sizeof(takenB));
	memset(takenC, false, sizeof(takenC));
	for(int c = 0 ; c < n ; c++){
		sum_pairs(c, c);
		sum_pairs(c + n, c);
	}
	for(int c = 0 ; c < n ; c++){
		C[c] = c;
		entered = false;
		for(int i = 0 ; i < (int)v[c].size() ; i++){
			if(!takenA[v[c][i].first] && !takenB[v[c][i].second]){
				entered = true;
				takenA[v[c][i].first] = true;
				takenB[v[c][i].second] = true;
				A[c] = v[c][i].first;
				B[c] = v[c][i].second;
				break;
			}
		}
		if(!entered){
			cout << -1;
			return 0;
		}
	}
	for(int i = 0 ; i < n ; i++){
		cout << A[i] << ' ';
	}
	cout << '\n';
	for(int i = 0 ; i < n ; i++){
		cout << B[i] << ' ';
	}
	cout << '\n';
	for(int i = 0 ; i < n ; i++){
		cout << C[i] << ' ';
	}
	return 0;
}


#include<iostream>

using namespace std;

int main(){
	int n;
	cin >> n;
	if(!(n & 1)){
		cout << -1;
		return 0;
	}
	int A[n], B[n], C[n];
	for(int c = 0 ; c < n ; c++){
		C[c] = c;
		if(c & 1){
			A[c] = B[c] = (c + n) / 2;
		}else{
			A[c] = B[c] = c / 2;
		}
	}
	for(int i = 0 ; i < n ; i++){
		cout << A[i] << ' ';
	}
	cout << '\n';
	for(int i = 0 ; i < n ; i++){
		cout << B[i] << ' ';
	}
	cout << '\n';
	for(int i = 0 ; i < n ; i++){
		cout << C[i] << ' ';
	}
	return 0;
}


#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <list>
#include <unordered_map>
#include <bitset>
#include <algorithm>
#define ll long long int
#define e() cout << endl;
#define MA INT_MAX
#define MI INT_MIN
#define MOD 1000000007;
#define ppi pair <int,int>
#define scn(n) scanf("%d",&n)
#define vvi(n,m,x) vector <vector <int> > v(n,vector <int> (m,x));
#define cp(x,y) cout << "Case : " << x << " " << y << endl;
using namespace std;
int main()
{
	int n;
	cin >> n;
	if(n % 2 == 0)
	{
		cout << "-1\n";
		return 0;
	}

	int a[n],b[n];
	for(int i = 0;i < n;i++)
	{
		a[i] = i;
		b[i] = (i + 1) % n;
		cout << i << " ";
	}
	e();
	for(int i = 0;i < n;i++)
		cout << b[i] << " ";
	e();

	for (int i = 0; i < n; ++i)
		cout << (a[i] + b[i]) % n << " ";
	e();

	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    scanf("%d",&n);
    if (n%2){
        for (int i=1;i<=n;++i)
            printf("%d ",i);
        printf("\n");
        for (int i=1;i<=n;++i)
            printf("%d ",i);
        printf("\n");
        for (int i=1;i<=n;++i)
            printf("%d ",i*2%n);
        printf("\n");
    }
    else
        printf("-1\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
int n;
int main(){
    scanf("%d",&n);
    if (n%2){
        for (int i=0;i<n;++i)
            printf("%d ",i);
        printf("\n");
        for (int i=0;i<n;++i)
            printf("%d ",i);
        printf("\n");
        for (int i=0;i<n;++i)
            printf("%d ",i*2%n);
        printf("\n");
    }
    else
        printf("-1\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int main()
{
	int n;
	cin>>n;
	if(n%2==0)
		cout<<-1;
	else
	{
		int a[maxn],b[maxn],c[maxn];
		for(int i=1;i<=n;i++)
			cout<<i-1<<" ";
		cout<<endl;
		for(int i=1;i<n;i++)
			cout<<i<<" ";
		cout<<0<<endl;
		for(int i=1;i<n;i++)
			cout<<(i+i-1)%n<<" ";
		cout<<(n-1)%n;
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+10;
int main()
{
	int n;
	cin>>n;
	if(n%2==0)
		cout<<-1;
	else
	{
		int a[maxn],b[maxn],c[maxn];
		for(int i=1;i<=n;i++)
			cout<<i-1<<" ";
		cout<<endl;
		for(int i=1;i<n;i++)
			cout<<i<<" ";
		cout<<0<<endl;
		for(int i=1;i<n;i++)
			cout<<(i+i-1)%n<<" ";
		cout<<(n-1)%n;
	}
	return 0;//123
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
signed main() {
	cin>>n;
	if (n%2==0) {
		puts("-1");
		return 0;
	}
	for (int i=0;i<n;++i) cout<<i<<' ';
	puts("");
	for (int i=0;i<n;++i) cout<<i<<' ';
	puts("");
	for (int i=0;i<n;++i) cout<<(i<<1)%n<<' ';
	puts("");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define int long long
int n;
signed main() {
	cin>>n;
	if (n%2==0) {
		puts("-1");
		return 0;
	}
	for (int i=1;i<=n;++i) cout<<i<<' ';
	puts("");
	for (int i=1;i<=n;++i) cout<<i<<' ';
	puts("");
	for (int i=1;i<=n;++i) cout<<(i<<1)<<' ';
	puts("");
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
int num[100005];
int a[100005];
int b[100005];
int main()
{
	int n,i;
	cin>>n;
	for(i=0;i<n;i++) num[i]=i;
	random_shuffle(num,num+n);
	if(n%2==0)
	{
		cout<<"-1";
		return 0;
	}
	for(i=0;i<n;i++)
	{
		if(num[i]%2==0)
		{
			a[i]=num[i]/2;
			b[i]=num[i]/2;
		}
		else
		{
			a[i]=(num[i]+n)/2;
			b[i]=(num[i]+n)/2;
		}
	}
	for(i=0;i<n;i++) cout<<a[i]<<" ";
	cout<<endl;
	for(i=0;i<n;i++) cout<<b[i]<<" ";
	cout<<endl;
	for(i=0;i<n;i++) cout<<num[i]<<" ";
	cout<<endl;
	return 0;
}


//
//  main.cpp
//  binarytrees
//
//  Created by vishal  on 9/24/16.
//  Copyright © 2016 vishal . All rights reserved.
//

#include <iostream>
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <unordered_map>
#include <cstring>
#include <set>
#include <stack>
#include <map>
#include <queue>
#include <functional>

typedef long long ll;

using namespace std;

int main(int argc, char ** argv)
{

    int n;
    cin>>n;

    if(n%2 == 0) {
        cout<<-1<<'\n';
    }
    else {
        for(int i = 0; i < n; i++) {
            cout<<i<<" ";
        }
        cout<<'\n';
        for(int i = 0; i < n; i++) {
            cout<<i<<" ";
        }
        cout<<'\n';
        for(int i = 0; i < n; i++) {
            cout<<(2*i)%n<<" ";
        }
        cout<<'\n';

    }

    return 0;
}


/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

int a[maxn], b[maxn], c[maxn];

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    scanf("%d", &n);

    if (n % 2 == 0) {
        puts("-1");
        return 0;
    }

    int pos = n - 1;
    int num = n - 1;
    for (int i = 0; i < n; i++) {
        a[i] = i;
        c[pos] = num;
        pos = (pos + 1) % n;
        num = (num - 1) % n;
    }

    for (int i = 0; i < n; i++) {
        b[i] = (c[i] - a[i] + n) % n;
    }

    for (int i = 0; i < n; i++) {
        if (i > 0)  printf(" ");
        printf("%d", a[i]);
    }
    puts("");

    for (int i = 0; i < n; i++) {
        if (i > 0)  printf(" ");
        printf("%d", b[i]);
    }
    puts("");

    for (int i = 0; i < n; i++) {
        if (i > 0)  printf(" ");
        printf("%d", c[i]);
    }
    puts("");

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


/*
    Written by Nitrogens
    Desire for getting accepted!!
*/
#include <cstdio>
#include <ctime>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <bitset>
#include <stack>
#include <set>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

const int maxn = 1e5+5;
const int Mod = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const double e = exp(1);
const db PI = acos(-1);
const db ERR = 1e-10;

#define Se second
#define Fi first
#define pb push_back
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define dbg2(x1,x2) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<endl
#define dbg3(x1,x2,x3) cout<<#x1<<" = "<<x1<<" "<<#x2<<" = "<<x2<<" "<<#x3<<" = "<<x3<<endl

int a[maxn], b[maxn], c[maxn];

int main()
{
    //ios::sync_with_stdio(false);
    //freopen("a.txt","r",stdin);
    //freopen("b.txt","w",stdout);

    int n;
    scanf("%d", &n);

    if (n % 2 == 0) return 0 * puts("-1");
    for (int i = 0; i < n; i++) {
        a[i] = b[i] = i;
        c[i] = 2 * i % n;
    }
    for (int i = 0; i < n; i++) {
        printf("%d ", a[i]);
    }
    puts("");
    for (int i = 0; i < n; i++) {
        printf("%d ", b[i]);
    }
    puts("");
    for (int i = 0; i < n; i++) {
        printf("%d ", c[i]);
    }

    //cout << "time: " << (long long)clock() * 1000 / CLOCKS_PER_SEC << " ms" << endl;
    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);
    LL l = (LL)(monsters[m2].first - teleports[t].first) * (LL)(monsters[m2].first - teleports[t].first) + (LL)(monsters[m2].second - teleports[t].second) * (LL)(monsters[m2].second - teleports[t].second);

    if(temp < 0 || temp > l)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) > n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n - j)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n - j)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);
    LL l = (LL)(monsters[m2].first - teleports[t].first) * (LL)(monsters[m2].first - teleports[t].first) + (LL)(monsters[m2].second - teleports[t].second) * (LL)(monsters[m2].second - teleports[t].second);

    if(temp < 0 || temp > l)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) > n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

            if(indanger)
            {
                break;
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);
    LL l = (LL)(monsters[m2].first - teleports[t].first) * (LL)(monsters[m2].first - teleports[t].first) + (LL)(monsters[m2].second - teleports[t].second) * (LL)(monsters[m2].second - teleports[t].second);

    if(temp < 0 || temp > l)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) >= n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n - j)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n - j)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - teleports[t].first, monsters[m2].second - teleports[t].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);

    if(temp < 0)
    {
        return false;
    }

    return dot(v1, v2) < dot(v2, v2);
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) > n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    tobekilled.insert(x);
                }

                if(SIZE(tobekilled) > n)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

            if(indanger)
            {
                break;
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    if(dot(v1, v2) < 0)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set<int> killed;
            set <int> tobekilled;

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) >= n)
            {
                continue;
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j][temp]]) > n - j)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n - j)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    if(dot(v1, v2) < 0)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) >= n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > 7)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > 7)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    if(dot(v1, v2) < 0)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set<int> killed;
            set <int> tobekilled;

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) >= n)
            {
                continue;
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    if(dot(v1, v2) < 0)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set<int> killed;
            set <int> tobekilled;

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) >= n)
            {
                continue;
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n - j)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n - j)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);
    LL l = (monsters[m2].first - teleports[t].first) * (monsters[m2].first - teleports[t].first) + (monsters[m2].second - teleports[t].second) * (monsters[m2].second - teleports[t].second);

    if(temp < 0 || temp >= l)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) >= n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n - j)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n - j)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);
    LL l = (LL)(monsters[m2].first - teleports[t].first) * (LL)(monsters[m2].first - teleports[t].first) + (LL)(monsters[m2].second - teleports[t].second) * (LL)(monsters[m2].second - teleports[t].second);

    if(temp < 0 || temp >= l)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) >= n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n - j)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > n - j)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);
    LL l = (LL)(monsters[m2].first - teleports[t].first) * (LL)(monsters[m2].first - teleports[t].first) + (LL)(monsters[m2].second - teleports[t].second) * (LL)(monsters[m2].second - teleports[t].second);

    if(temp <= 0 || temp > l)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            if(SIZE(blocking[perm[0]][i]) > n)
            {
                continue;
            }

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > n)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    tobekilled.insert(x);
                }

                if(SIZE(tobekilled) > n)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

            if(indanger)
            {
                break;
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL> p1, pair <LL, LL> p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - monsters[m1].first, monsters[m2].second - monsters[m1].second);

    if(cross(v1, v2))
    {
        return false;
    }

    if(dot(v1, v2) < 0)
    {
        return false;
    }

    return true;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        vector <int> perm;

        FOR(j, 0, n)
        {
            perm.PB(j);
        }

        bool indanger = false;

        do
        {
            set <int> tobekilled;

            for(auto& x : blocking[perm[0]][i])
            {
                tobekilled.insert(x);
            }

            if(SIZE(tobekilled) >= n)
            {
                continue;
            }

            if(SIZE(tobekilled) == 0)
            {
                indanger = true;
                break;
            }

            FOR(j, 1, n)
            {
                int temp = *tobekilled.begin();
                tobekilled.erase(tobekilled.begin());

                if(SIZE(blocking[perm[j]][temp]) > 7)
                {
                    break;
                }

                for(auto& x : blocking[perm[j]][temp])
                {
                    if(!tobekilled.count(x))
                    {
                        tobekilled.insert(x);
                    }
                }

                if(SIZE(tobekilled) > 7)
                {
                    break;
                }

                if(!SIZE(tobekilled))
                {
                    indanger = true;
                    break;
                }
            }

        } while (next_permutation(ALL(perm)));

        if(indanger)
        {
            ++result;
        }
    }

    cout << result;

    return 0;
}


#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

#define BOOST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define PB push_back
#define MP make_pair
#define INF (int)1e9+7
#define LLINF 4e18+7
#define ALL(a) a.begin(), a.end()
#define SIZE(a) (int)a.size()

typedef long long LL;
typedef long double LD;

using namespace std;

const int MAX = 1007;
pair <int, int> teleports[7];
pair <int, int> monsters[MAX];
vector <int> blocking[7][MAX];

LL cross(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.second - p1.second * p2.first;
}

LL dot(pair <LL, LL>& p1, pair <LL, LL>& p2)
{
    return p1.first * p2.first + p1.second * p2.second;
}

bool between(int t, int m1, int m2)
{
    pair <LL, LL> v1 = MP(monsters[m1].first - teleports[t].first, monsters[m1].second - teleports[t].second);
    pair <LL, LL> v2 = MP(monsters[m2].first - teleports[t].first, monsters[m2].second - teleports[t].second);

    if(cross(v1, v2))
    {
        return false;
    }

    LL temp = dot(v1, v2);

    if(temp < 0)
    {
        return false;
    }

    return temp < dot(v2, v2);
}

bool generate(set <int> left, set <int> tokill)
{
    if(SIZE(tokill) == 0)
        return true;

    if(SIZE(tokill) > SIZE(left))
        return false;

    set <int> cpy = left;
    set <int> temp = tokill;

    for(auto& i : cpy)
    {
        for(auto& j : temp)
        {
            set <int> newleft = left;
            set <int> newtokill = tokill;

            if(SIZE(blocking[i][j]) > SIZE(newleft))
            {
               continue;
            }

            for(auto& x : blocking[i][j])
            {
                newtokill.insert(x);
            }

            if(SIZE(newtokill) > SIZE(newleft))
            {
                continue;
            }

            newleft.erase(i);
            newtokill.erase(j);

            if(generate(newleft, newtokill))
                return true;
        }
    }

    return false;
}

int main()
{
    BOOST;

    int n, k;

    cin >> n >> k;

    FOR(i, 0, n)
    {
        cin >> teleports[i].first >> teleports[i].second;
    }

    FOR(i, 0, k)
    {
        cin >> monsters[i].first >> monsters[i].second;
    }

    FOR(i, 0, n)
    {
        FOR(j, 0, k)
        {
            FOR(x, 0, k)
            {
                if(x != j && between(i, x, j))
                {
                    blocking[i][j].PB(x);
                }
            }
        }
    }

    int result = 0;

    FOR(i, 0, k)
    {
        set <int> x;
        set <int> perm;

        FOR(j, 0, n)
            perm.insert(j);
        x.insert(i);

        if(generate(perm, x))
            ++result;
    }

    cout << result;

    return 0;
}


#include <bits/stdc++.h>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct Vec {
  int x, y;
  Vec(int x = 0, int y = 0) : x(x), y(y) {}
  Vec operator+(const Vec& rhs) const { return Vec(x + rhs.x, y + rhs.y); }
  Vec operator-() const { return Vec(-x, -y); }
  Vec operator-(const Vec& rhs) const { return *this + (-rhs); }
  ll operator^(const Vec& rhs) const { return x * (ll)rhs.x + y * (ll)rhs.y; }
  ll operator*(const Vec& rhs) const { return x * (ll)rhs.y - rhs.x * (ll)y; }
};

const int N = 1010, K = 10;

int k, n, cnt;
Vec a[K], m[N];
vector<int> block[N][K];
int tmp[K * 2];
int t[N], vis[N];
bool use[K];

bool dfs(int j) {
  if (j > cnt) return true;
  t[tmp[j]] = j;
  for (int i = 1; i <= k; ++i) {
    if (use[i]) continue;
    int o = cnt;
    int brkx = 0;
    for (int x : block[tmp[j]][i]) {
      if (t[x]) {
        brkx = x;
        break;
      }
      if (vis[x]++ == 0)
        tmp[++cnt] = x;
      if (cnt > k) {
        brkx = x;
        break;
      }
    }
    use[i] = true;
    if (!brkx && dfs(j + 1))
      return true;
    use[i] = false;
    for (int x : block[tmp[j]][i]) {
      if (t[x]) break;
      --vis[x];
      if (brkx == x) break;
    }
    cnt = o;
  }
  t[tmp[j]] = 0;
  return false;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> k >> n;
  for (int i = 1; i <= k; ++i) cin >> a[i].x >> a[i].y;
  for (int i = 1; i <= n; ++i) cin >> m[i].x >> m[i].y;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= k; ++j)
      for (int l = 1; l <= n; ++l)
        if (((m[i] - m[l]) ^ (a[j] - m[l])) < 0 && ((m[l] - a[j]) * (m[i] - a[j])) == 0) {
          block[i][j].push_back(l);
          if (block[i][j].size() > k) break;
        }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    tmp[++cnt] = i;
    vis[i] = 1;
    ans += dfs(1);
    memset(t, 0, sizeof(t));
    memset(vis, 0, sizeof(vis));
    memset(tmp, 0, sizeof(tmp));
    memset(use, 0, sizeof(use));
    cnt = 0;
  }
  cout << ans;

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
      -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


#include <bits/stdc++.h>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct Vec {
  int x, y;
  Vec(int x = 0, int y = 0) : x(x), y(y) {}
  Vec operator+(const Vec& rhs) const { return Vec(x + rhs.x, y + rhs.y); }
  Vec operator-() const { return Vec(-x, -y); }
  Vec operator-(const Vec& rhs) const { return *this + (-rhs); }
  ll operator^(const Vec& rhs) const { return x * (ll)rhs.x + y * (ll)rhs.y; }
  ll operator*(const Vec& rhs) const { return x * (ll)rhs.y - rhs.x * (ll)y; }
};

const int N = 1010, K = 10;

int k, n, cnt;
Vec a[K], m[N];
vector<int> block[N][K];
int tmp[K * 2];
int t[N], vis[N];
bool use[K];

bool dfs(int j) {
  if (j > cnt) return true;
  for (int i = 1; i <= k; ++i) {
    if (use[i]) continue;
    for (int y = j; y <= cnt; ++y) {
      swap(tmp[j], tmp[y]);
      int o = cnt;
      int brkx = 0;
      for (int x : block[tmp[j]][i]) {
        if (t[x]) {
          brkx = x;
          break;
        }
        if (vis[x]++ == 0)
          tmp[++cnt] = x;
        if (cnt > k) {
          brkx = x;
          break;
        }
      }
      if (!brkx) {
        use[i] = true;
        t[tmp[j]] = j;
        if (dfs(j + 1))
          return true;
        t[tmp[j]] = 0;
        use[i] = false;
      }
      for (int x : block[tmp[j]][i]) {
        if (t[x]) break;
        --vis[x];
        if (brkx == x) break;
      }
      cnt = o;
//      if (!brkx) break;
    }
    for (int y = cnt; y > j; --y) swap(tmp[y], tmp[j]);
  }
  return false;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> k >> n;
  for (int i = 1; i <= k; ++i) cin >> a[i].x >> a[i].y;
  for (int i = 1; i <= n; ++i) cin >> m[i].x >> m[i].y;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= k; ++j)
      for (int l = 1; l <= n; ++l)
        if (((m[i] - m[l]) ^ (a[j] - m[l])) < 0 && ((m[l] - a[j]) * (m[i] - a[j])) == 0) {
          block[i][j].push_back(l);
          if (block[i][j].size() > k) break;
        }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    tmp[++cnt] = i;
    vis[i] = 1;
    ans += dfs(1);
    memset(t, 0, sizeof(t));
    memset(vis, 0, sizeof(vis));
    memset(tmp, 0, sizeof(tmp));
    memset(use, 0, sizeof(use));
    cnt = 0;
  }
  cout << ans;

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
      -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


#include <bits/stdc++.h>

#define LOG(FMT...) fprintf(stderr, FMT)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

// mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

struct Vec {
  int x, y;
  Vec(int x = 0, int y = 0) : x(x), y(y) {}
  Vec operator+(const Vec& rhs) const { return Vec(x + rhs.x, y + rhs.y); }
  Vec operator-() const { return Vec(-x, -y); }
  Vec operator-(const Vec& rhs) const { return *this + (-rhs); }
  ll operator^(const Vec& rhs) const { return x * (ll)rhs.x + y * (ll)rhs.y; }
  ll operator*(const Vec& rhs) const { return x * (ll)rhs.y - rhs.x * (ll)y; }
};

const int N = 1010, K = 10;

int k, n, cnt;
Vec a[K], m[N];
vector<int> block[N][K];
int tmp[K * 2];
int t[N], vis[N];
bool use[K];

bool dfs(int j) {
  if (j > cnt) return true;
  for (int i = 1; i <= k; ++i) {
    if (use[i]) continue;
    for (int y = j; y <= cnt; ++y) {
      swap(tmp[j], tmp[y]);
      int o = cnt;
      int brkx = 0;
      for (int x : block[tmp[j]][i]) {
        if (t[x]) {
          brkx = x;
          break;
        }
        if (vis[x]++ == 0)
          tmp[++cnt] = x;
        if (cnt > k) {
          brkx = x;
          break;
        }
      }
      use[i] = true;
      if (!brkx) {
        t[tmp[j]] = j;
        if (dfs(j + 1))
          return true;
        t[tmp[j]] = 0;
      }
      use[i] = false;
      for (int x : block[tmp[j]][i]) {
        if (t[x]) break;
        --vis[x];
        if (brkx == x) break;
      }
      cnt = o;
//      if (!brkx) break;
    }
  }
  return false;
}

int main() {
#ifdef LBT
  freopen("test.in", "r", stdin);
  int nol_cl = clock();
#endif
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  cin >> k >> n;
  for (int i = 1; i <= k; ++i) cin >> a[i].x >> a[i].y;
  for (int i = 1; i <= n; ++i) cin >> m[i].x >> m[i].y;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= k; ++j)
      for (int l = 1; l <= n; ++l)
        if (((m[i] - m[l]) ^ (a[j] - m[l])) < 0 && ((m[l] - a[j]) * (m[i] - a[j])) == 0) {
          block[i][j].push_back(l);
          if (block[i][j].size() > k) break;
        }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    tmp[++cnt] = i;
    vis[i] = 1;
    ans += dfs(1);
    memset(t, 0, sizeof(t));
    memset(vis, 0, sizeof(vis));
    memset(tmp, 0, sizeof(tmp));
    memset(use, 0, sizeof(use));
    cnt = 0;
  }
  cout << ans;

#ifdef LBT
  LOG("Time: %dms\n", int ((clock()
      -nol_cl) / (double)CLOCKS_PER_SEC * 1000));
#endif
  return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;
#define MAX 1005
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    x+=y; if (x>=mod) x-=mod;
}
void et() {
    puts("-1"); exit(0);
}

ll gcd1(ll x, ll y) {
    ll z = y;
    while(x%y!=0) {
        z = x%y; x = y; y = z;
    }
    return z;
}
typedef ll ValType;
struct Point {
    ValType x, y;
    Point() { }
    Point(ValType x, ValType y) : x(x), y(y) { }
    ll abs() const { return x*x+y*y ;}

    Point operator*(double o) const { return Point(x * o, y * o); }
    Point operator+(const Point& o) const { return Point(x + o.x, y + o.y); }
    Point operator-(const Point& o) const { return Point(x - o.x, y - o.y); }
    bool operator<(const Point& o) const { return x < o.x - EPS || (x < o.x + EPS && y < o.y - EPS); }
    friend bool operator == (const Point &r1,const Point &r2)
    {return r1.x==r2.x&&r1.y==r2.y;}

    Point scale(double o) const { return *this * (o / abs()); }
    Point rotY() const { return Point(-y, x); }
    Point rotX() const { return Point(y, -x); }
    ValType cross(Point b) const {return x*b.y- b.x*y;}
    ValType dot(Point b) const {return x*b.x + y*b.y;}
    ld disToSeg(Point &a, Point &b) {
        return fabs(((*this)-a).cross(b-a) / (b-a).abs());
    }
    void readin() {
        scanf("%lld%lld", &x, &y);
    }
    pair<ll, ll> getVec() {
        if (x==0) return {0, y>0?1:-1};
        if (y==0) return {x<0?-1:1, 0};
        ll gg = gcd1(::abs(x),::abs(y));
        ll px=x/gg,py=y/gg;
        return {px,py};
    }
}st[10],ms[MAX];
int id[10], w[MAX];
bool ans[MAX];
void cal() {
    memset(w,0,sizeof w);
    REP(i,k) {
        Point o = st[id[i]];
        map<pair<ll, ll>, vector<pair<ll, int>>> mp;
        REP(j,n) {
            Point b = (ms[j]-o);
            pair<ll, ll> vec = b.getVec();
            if (mp[vec].size()<7)
            mp[vec].push_back({b.abs(), j});
        }
        for(auto &p : mp) {
            sort(p.second.begin(), p.second.end());
            int cnt=0;
            for(auto &q : p.second) {
                w[q.second] |= (1<<i);
                if (cnt>=i) break;
                if (w[q.second] & (1<<cnt)) cnt++;
                else break;
            }
        }
    }
    REP(i,n) if (w[i]) ans[i]=1;
}
void fmain() {
    scanf("%d%d", &k,&n);
    REP(i,k) {
        st[i].readin(); id[i]=i;
    }
    REP(i,n) ms[i].readin();
    do {
        cal();
    } while(next_permutation(id,id+k));
    int A=0;
    REP(i,n) if (ans[i]) A++;
    printf("%d\n", A);
}
int main() {
    fmain();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;
#define MAX 1005
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    x+=y; if (x>=mod) x-=mod;
}
void et() {
    puts("-1"); exit(0);
}

ll gcd1(ll x, ll y) {
    ll z = y;
    while(x%y!=0) {
        z = x%y; x = y; y = z;
    }
    return z;
}
typedef ll ValType;
struct Point {
    ValType x, y;
    Point() { }
    Point(ValType x, ValType y) : x(x), y(y) { }
    ll abs() const { return x*x+y*y ;}

    Point operator*(double o) const { return Point(x * o, y * o); }
    Point operator+(const Point& o) const { return Point(x + o.x, y + o.y); }
    Point operator-(const Point& o) const { return Point(x - o.x, y - o.y); }
    bool operator<(const Point& o) const { return x < o.x - EPS || (x < o.x + EPS && y < o.y - EPS); }
    friend bool operator == (const Point &r1,const Point &r2)
    {return r1.x==r2.x&&r1.y==r2.y;}

    Point scale(double o) const { return *this * (o / abs()); }
    Point rotY() const { return Point(-y, x); }
    Point rotX() const { return Point(y, -x); }
    ValType cross(Point b) const {return x*b.y- b.x*y;}
    ValType dot(Point b) const {return x*b.x + y*b.y;}
    ld disToSeg(Point &a, Point &b) {
        return fabs(((*this)-a).cross(b-a) / (b-a).abs());
    }
    void readin() {
        scanf("%lld%lld", &x, &y);
    }
    pair<ll, ll> getVec() {
        if (x==0) return {0, y>0?1:-1};
        if (y==0) return {x<0?-1:1, 0};
        ll gg = gcd1(::abs(x),::abs(y));
        ll px=x/gg,py=y/gg;
        return {px,py};
    }
}st[10],ms[MAX];
int id[10], Q[MAX],w;
bool vis[MAX];
map<pair<ll, ll>, vector<pair<ll, int>>> mp[10];
vector<pair<ll, int>> *b[MAX][10];
void init() {
    REP(i,k) {
        Point o = st[i];
        REP(j,n) {
            Point b = (ms[j]-o);
            pair<ll, ll> vec = b.getVec();
            if (mp[i][vec].size()<10)
            mp[i][vec].push_back({b.abs(), j});
        }
        for(auto &p : mp[i]) {
            sort(p.second.begin(), p.second.end());
            for(auto v : p.second) b[v.second][i]=&p.second;
        }
    }
}

void fmain() {
    scanf("%d%d", &k,&n);
    REP(i,k) {
        st[i].readin();
    }
    REP(i,n) ms[i].readin();
    init(); int A=0;
    REP(i,n) {
        REP(i,k) id[i]=i;
        do {
            Q[w=1]=i; vis[i]=1;
            for(int j=1;j<=k && j<=w && w<=k;j++ ) {
                int l=0,x;
                for(;x=b[Q[j]][id[j-1]]->at(l).second, x!=Q[j] && w<=k;l++) {
                    if (!vis[x]) {
                        Q[++w]=x; vis[x]=1;
                    }
                }
            }
            REQ(j,w) vis[Q[j]]=0;
            if (w<=k) {A++; break;}
        } while(next_permutation(id,id+k));
    }
    printf("%d\n", A);
}
int main() {
    fmain();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;
#define MAX 1005
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    x+=y; if (x>=mod) x-=mod;
}
void et() {
    puts("-1"); exit(0);
}

ll gcd1(ll x, ll y) {
    ll z = y;
    while(x%y!=0) {
        z = x%y; x = y; y = z;
    }
    return z;
}
typedef ll ValType;
struct Point {
    ValType x, y;
    Point() { }
    Point(ValType x, ValType y) : x(x), y(y) { }
    ll abs() const { return x*x+y*y ;}

    Point operator*(double o) const { return Point(x * o, y * o); }
    Point operator+(const Point& o) const { return Point(x + o.x, y + o.y); }
    Point operator-(const Point& o) const { return Point(x - o.x, y - o.y); }
    bool operator<(const Point& o) const { return x < o.x - EPS || (x < o.x + EPS && y < o.y - EPS); }
    friend bool operator == (const Point &r1,const Point &r2)
    {return r1.x==r2.x&&r1.y==r2.y;}

    Point scale(double o) const { return *this * (o / abs()); }
    Point rotY() const { return Point(-y, x); }
    Point rotX() const { return Point(y, -x); }
    ValType cross(Point b) const {return x*b.y- b.x*y;}
    ValType dot(Point b) const {return x*b.x + y*b.y;}
    ld disToSeg(Point &a, Point &b) {
        return fabs(((*this)-a).cross(b-a) / (b-a).abs());
    }
    void readin() {
        scanf("%lld%lld", &x, &y);
    }
    pair<ll, ll> getVec() {
        if (x==0) return {0, y>0?1:-1};
        if (y==0) return {x<0?-1:0, 0};
        ll gg = gcd1(::abs(x),::abs(y));
        ll px=x/gg,py=y/gg;
        return {px,py};
    }
}st[10],ms[MAX];
int id[10];
bool vis[MAX], ans[MAX];
void cal() {
    memset(vis,0,sizeof vis);
    REP(i,k) {
        Point o = st[id[i]];
        map<pair<ll, ll>, int> mp;
        REP(j,n) if (!vis[j]){
            Point b = (ms[j]-o);
            pair<ll, ll> vec = b.getVec();
            if (mp.find(vec) == mp.end() || (ms[mp[vec]]-o).abs() > b.abs() ) {
                mp[vec] = j;
            }
        }
        for(auto &p : mp) {
            vis[p.second]=1; ans[p.second]=1;
        }
    }
}
void fmain() {
    scanf("%d%d", &k,&n);
    REP(i,k) {
        st[i].readin(); id[i]=i;
    }
    REP(i,n) ms[i].readin();
    do {
        cal();
    } while(next_permutation(id,id+k));
    int A=0;
    REP(i,n) if (ans[i]) A++;
    printf("%d\n", A);
}
int main() {
    fmain();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;
#define MAX 1005
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    x+=y; if (x>=mod) x-=mod;
}
void et() {
    puts("-1"); exit(0);
}

ll gcd1(ll x, ll y) {
    ll z = y;
    while(x%y!=0) {
        z = x%y; x = y; y = z;
    }
    return z;
}
typedef ll ValType;
struct Point {
    ValType x, y;
    Point() { }
    Point(ValType x, ValType y) : x(x), y(y) { }
    ll abs() const { return x*x+y*y ;}

    Point operator*(double o) const { return Point(x * o, y * o); }
    Point operator+(const Point& o) const { return Point(x + o.x, y + o.y); }
    Point operator-(const Point& o) const { return Point(x - o.x, y - o.y); }
    bool operator<(const Point& o) const { return x < o.x - EPS || (x < o.x + EPS && y < o.y - EPS); }
    friend bool operator == (const Point &r1,const Point &r2)
    {return r1.x==r2.x&&r1.y==r2.y;}

    Point scale(double o) const { return *this * (o / abs()); }
    Point rotY() const { return Point(-y, x); }
    Point rotX() const { return Point(y, -x); }
    ValType cross(Point b) const {return x*b.y- b.x*y;}
    ValType dot(Point b) const {return x*b.x + y*b.y;}
    ld disToSeg(Point &a, Point &b) {
        return fabs(((*this)-a).cross(b-a) / (b-a).abs());
    }
    void readin() {
        scanf("%lld%lld", &x, &y);
    }
    pair<ll, ll> getVec() {
        if (x==0) return {0, y>0?1:-1};
        if (y==0) return {x<0?-1:1, 0};
        ll gg = gcd1(::abs(x),::abs(y));
        ll px=x/gg,py=y/gg;
        return {px,py};
    }
}st[10],ms[MAX];
int id[10], w[MAX];
bool ans[MAX];
map<pair<ll, ll>, vector<pair<ll, int>>> mp[10];
void init() {
    REP(i,k) {
        Point o = st[i];
        REP(j,n) {
            Point b = (ms[j]-o);
            pair<ll, ll> vec = b.getVec();
            if (mp[i][vec].size()<7)
            mp[i][vec].push_back({b.abs(), j});
        }
        for(auto &p : mp[i]) {
            sort(p.second.begin(), p.second.end());
        }
    }
}
void cal() {
    memset(w,0,sizeof w);
    REP(i,k) {
        for(auto &p : mp[id[i]]) {
            int cnt=0;
            for(auto &q : p.second) {
                w[q.second] |= (1<<i);
                if (cnt>=i) break;
                if (w[q.second] & (1<<cnt)) cnt++;
                else break;
            }
        }
    }
    REP(i,n) if (w[i]) ans[i]=1;
}
void fmain() {
    scanf("%d%d", &k,&n);
    REP(i,k) {
        st[i].readin(); id[i]=i;
    }
    REP(i,n) ms[i].readin();
    init();
    do {
        cal();
    } while(next_permutation(id,id+k));
    int A=0;
    REP(i,n) if (ans[i]) A++;
    printf("%d\n", A);
}
int main() {
    fmain();
    return 0;
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <cmath>
#include <set>
#include <map>
#include <cstdio>
#include <stdlib.h>
#include <stack>
#include <numeric>
#include <bitset>
#include <cctype>
#include <list>
#include <assert.h>
#include <random>
#include <unordered_map>
#include <ctime>
typedef  long long ll;
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef pair<int, int> pii;
typedef long double ld;
typedef unsigned int uint;
#define MAX 1005
bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD) {
    x+=y; if (x>=mod) x-=mod;
}
void et() {
    puts("-1"); exit(0);
}

ll gcd1(ll x, ll y) {
    ll z = y;
    while(x%y!=0) {
        z = x%y; x = y; y = z;
    }
    return z;
}
typedef ll ValType;
struct Point {
    ValType x, y;
    Point() { }
    Point(ValType x, ValType y) : x(x), y(y) { }
    ll abs() const { return x*x+y*y ;}

    Point operator*(double o) const { return Point(x * o, y * o); }
    Point operator+(const Point& o) const { return Point(x + o.x, y + o.y); }
    Point operator-(const Point& o) const { return Point(x - o.x, y - o.y); }
    bool operator<(const Point& o) const { return x < o.x - EPS || (x < o.x + EPS && y < o.y - EPS); }
    friend bool operator == (const Point &r1,const Point &r2)
    {return r1.x==r2.x&&r1.y==r2.y;}

    Point scale(double o) const { return *this * (o / abs()); }
    Point rotY() const { return Point(-y, x); }
    Point rotX() const { return Point(y, -x); }
    ValType cross(Point b) const {return x*b.y- b.x*y;}
    ValType dot(Point b) const {return x*b.x + y*b.y;}
    ld disToSeg(Point &a, Point &b) {
        return fabs(((*this)-a).cross(b-a) / (b-a).abs());
    }
    void readin() {
        scanf("%lld%lld", &x, &y);
    }
    pair<ll, ll> getVec() {
        if (x==0) return {0, y>0?1:-1};
        if (y==0) return {x<0?-1:1, 0};
        ll gg = gcd1(::abs(x),::abs(y));
        ll px=x/gg,py=y/gg;
        return {px,py};
    }
}st[10],ms[MAX];
int id[10], Q[MAX],w;
bool vis[MAX];
map<pair<ll, ll>, vector<pair<ll, int>>> mp[10];
vector<pair<ll, int>> *b[MAX][10];
void init() {
    REP(i,k) {
        Point o = st[i];
        REP(j,n) {
            Point b = (ms[j]-o);
            pair<ll, ll> vec = b.getVec();
//            if (mp[i][vec].size()<7)
            mp[i][vec].push_back({b.abs(), j});
        }
        for(auto &p : mp[i]) {
            sort(p.second.begin(), p.second.end());
            for(auto v : p.second) b[v.second][i]=&p.second;
        }
    }
}

void fmain() {
    scanf("%d%d", &k,&n);
    REP(i,k) {
        st[i].readin();
    }
    REP(i,n) ms[i].readin();
    init(); int A=0;
    REP(i,n) {
        REP(i,k) id[i]=i;
        do {
            Q[w=1]=i; vis[i]=1;
            for(int j=1;j<=k && j<=w && w<=k;j++ ) {
                int l=0,x;
                for(;x=b[Q[j]][id[j-1]]->at(l).second, x!=Q[j] && w<=k;l++) {
                    if (!vis[x]) {
                        Q[++w]=x; vis[x]=1;
                    }
                }
            }
            REQ(j,w) vis[Q[j]]=0;
            if (w<=k) {A++; break;}
        } while(next_permutation(id,id+k));
    }
    printf("%d\n", A);
}
int main() {
    fmain();
    return 0;
}


#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#ifndef rd
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=(c); a++)
#define rep(a,b,c) for(int a=b; a<(c); a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

pii a[1005];
pii s[7];
vi inside[7][1005];
bool kill[1005];
void solve() {
	int kk,n;
	cin>>kk>>n;
	rep(i,0,kk)
		cin>>s[i].fi>>s[i].se;
	fr(i,1,n)
		cin>>a[i].fi>>a[i].se;
	rep(k,0,kk)
		fr(i,1,n)
			fr(j,1,n)
				if((a[j].fi-a[i].fi)*(s[k].se-a[i].se)==(a[j].se-a[i].se)*(s[k].fi-a[i].fi))
					if((a[i].fi<=a[j].fi&&a[j].fi<=s[k].fi)||(a[i].fi>=a[j].fi&&a[j].fi>=s[k].fi))
						if((a[i].se<=a[j].se&&a[j].se<=s[k].se)||(a[i].se>=a[j].se&&a[j].se>=s[k].se))
							inside[k][i].pb(j);
	int ans=0;
	fr(i,1,n) {
		vi p(kk);
		iota(all(p),0LL);
		do {
			vi oth={i};
			set<int> lol={i};
			bool vald=1;
			for(int i=0; i<sz(oth); i++) {
				if(i==kk||sz(inside[p[i]][oth[i]])>kk) {
					vald=0;
					break;
				}
				for(int j:inside[p[i]][oth[i]])
					if(lol.find(j)==lol.end()) {
						lol.insert(j);
						oth.pb(j);
					}
			}

			if(vald) {
				ans++;
				break;
			}
		} while(next_permutation(all(p)));
	}
	cout<<ans<<endl;
}

signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(12);
	int t=1;
//	cin>>t;
	while(t--)
		solve();
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010],ans,ok[1010];
bool flag[1010];
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=abs(__gcd(cur.x,cur.y));
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			vector<int> opt;
			for(int j=1;j<=K;j++)
			{
				int p=id[j];
				int d=dir[j][i],cur=0;
				while(flag[pos[p][d][cur]])cur++;
				if(pos[p][d][cur]==i)
				{
					ok[i]=1;
					ans++;
					break;
				}
				flag[pos[p][d][cur]]=1;
				opt.push_back(pos[p][d][cur]);
			}
			for(auto &x:opt)flag[x]=0;
		}
		next_permutation(id+1,id+K+1);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010],ans,ok[1010];
bool flag[1010];
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=__gcd(cur.x,cur.y);
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			vector<int> opt;
			for(int j=1;j<=K;j++)
			{
				int p=id[j];
				int d=dir[j][i],cur=0;
				while(flag[pos[p][d][cur]])cur++;
				if(pos[p][d][cur]==i)
				{
					ok[i]=1;
					ans++;
					break;
				}
				flag[pos[p][d][cur]]=1;
				opt.push_back(pos[p][d][cur]);
			}
			for(auto &x:opt)flag[x]=0;
		}
		next_permutation(id+1,id+K+1);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010],ans,ok[1010];
bool flag[1010];
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=__gcd(abs(cur.x),abs(cur.y));
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	id[K+1]=0;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			vector<int> opt;
			for(int j=1;j<=K;j++)
			{
				int p=id[j];
				int d=dir[p][i],cur=0;
				while(flag[pos[p][d][cur]])cur++;
				if(pos[p][d][cur]==i)
				{
					ok[i]=1;
					ans++;
					break;
				}
				flag[pos[p][d][cur]]=1;
				opt.push_back(pos[p][d][cur]);
			}
			for(auto &x:opt)flag[x]=0;
		}
		next_permutation(id+1,id+K+1);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010];
bool flag[1010],ok[1010];
int ans=0;
vector<int> opt;
bool dfs(int attack,int &num)
{
	if(num>K)return 0;
	int p=id[num];
	int d=dir[p][attack];
	num++;
	for(int i=0;;i++)
	{
		if(pos[p][d][i]==attack)break;
		if(flag[pos[p][d][i]])continue;
		if(!dfs(pos[p][d][i],num))return 0;
	}
	flag[attack]=1;
	opt.push_back(attack);
	return 1;
}
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=__gcd(abs(cur.x),abs(cur.y));
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			int cnt=1;
			opt.clear();
			if(dfs(i,cnt))
			{
				ans++;
				ok[i]=1;
			}
			for(int &x:opt)flag[x]=0;
		}
		next_permutation(id+1,id+K+1);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010];
bool flag[1010],ok[1010];
int ans=0;
vector<int> opt;
bool dfs(int attack,int &num)
{
	if(num>K)return 0;
	int p=id[num];
	int d=dir[p][attack];
	num++;
	for(int i=0;;i++)
	{
		if(pos[p][d][i]==attack)break;
		if(flag[pos[p][d][i]])continue;
		if(!dfs(pos[p][d][i],num))return 0;
	}
	flag[attack]=1;
	opt.push_back(attack);
	return 1;
}
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=__gcd(abs(cur.x),abs(cur.y));
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			int cnt=1;
			opt.clear();
			if(dfs(i,cnt))
			{
				ans++;
				ok[i]=1;
			}
			for(int &x:opt)flag[x]=0;
		}
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010],ans,ok[1010];
bool flag[1010];
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=__gcd(abs(cur.x),abs(cur.y));
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			vector<int> opt;
			for(int j=1;j<=K;j++)
			{
				int p=id[j];
				int d=dir[p][i],cur=0;
				while(flag[pos[p][d][cur]])cur++;
				if(pos[p][d][cur]==i)
				{
					ok[i]=1;
					ans++;
					break;
				}
				flag[pos[p][d][cur]]=1;
				opt.push_back(pos[p][d][cur]);
			}
			for(auto &x:opt)flag[x]=0;
		}
		next_permutation(id+1,id+K+1);
	}
	printf("%d\n",ans);
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
class vec
{
	public:
		int x,y;
		vec(){}
		vec(int tx,int ty)
		{
			x=tx,y=ty;
		}
		vec operator -(const vec &t)const
		{
			return vec(x-t.x,y-t.y);
		}
		ll len()
		{
			return 1ll*x*x+1ll*y*y;
		}
}a[8],m[1010];
vec cet;
int id[1010];
map<pair<int,int>,int> mp;
inline int cmp2(const int &a,const int &b)
{
	return (m[a]-cet).len()<(m[b]-cet).len();
}
const int fac[10]={1,1,2,6,24,120,720,5040};
int K,n;
vector<int> pos[8][1010];
int dir[8][1010],ans,ok[1010];
bool flag[1010];
int main()
{
	scanf("%d%d",&K,&n);
	for(int i=1;i<=K;i++)
		scanf("%d%d",&a[i].x,&a[i].y);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&m[i].x,&m[i].y);
	for(int i=1;i<=K;i++)
	{
		cet=a[i];
		mp.clear();
		int cnt=0;
		for(int j=1;j<=n;j++)id[j]=j;
		sort(id+1,id+n+1,cmp2);
		for(int j=1;j<=n;j++)
		{
			int p=id[j];
			vec cur=m[p]-a[i];
			int g=abs(__gcd(cur.x,cur.y));
			pair<int,int> direc=make_pair(cur.x/g,cur.y/g);
			if(mp.find(direc)==mp.end())mp[direc]=++cnt;
			int d=mp[direc];
			dir[i][p]=d;
			pos[i][d].push_back(p);
		}
	}
	for(int i=1;i<=K;i++)id[i]=i;
	for(int T=1;T<=fac[K];T++)
	{
		for(int i=1;i<=n;i++)
		{
			if(ok[i])continue;
			vector<int> opt;
			for(int j=1;j<=K;j++)
			{
				int p=id[j];
				int d=dir[p][i],cur=0;
				while(flag[pos[p][d][cur]])cur++;
				if(pos[p][d][cur]==i)
				{
					ok[i]=1;
					ans++;
					break;
				}
				flag[pos[p][d][cur]]=1;
				opt.push_back(pos[p][d][cur]);
			}
			for(auto &x:opt)flag[x]=0;
		}
		next_permutation(id+1,id+K+1);
	}
	printf("%d\n",ans);
	return 0;
}