#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
struct node
{
double x,y;
}map[20];
int f[21][21];
int dp[1<<21],T,n,m;
double A(node a,node b)
{
return (a.y*b.x-b.y*a.x)/((a.x*a.x*b.x)-(b.x*b.x*a.x));
}
double B(double a,node b)
{
return (b.y-(a*b.x*b.x))/b.x;
}
int same(double x,double y)
{
if(fabs(x-y)<=0.0000001)return 1;
return 0;
}
double Y(double a,double b,double x)
{
return (a*x*x)+(b*x);
}
void init()
{
memset(f,0,sizeof(f));
memset(dp,0x3f,sizeof(dp));
memset(map,0,sizeof(map));
}
int main()
{
scanf("%d",&T);
while(T>0)
{
T--;
init();
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++)
{
scanf("%lf%lf",&map[i].x,&map[i].y);
}
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
double a=A(map[i],map[j]);
double b=B(a,map[i]);
if(a>=0)continue;
for(int k=1;k<=n;k++)
{
if(same(Y(a,b,map[k].x),map[k].y)==1)
{
f[i][j]=f[i][j]|(1<<(k-1));
}
}
}
}
dp[0]=0;
dp[1]=1;
for(int S=0;S<=1<<n;++S)
{
for(int i=1;i<=n;i++)
{
if(!(S&(1<<(i-1))))
{
dp[S|(1<<(i-1))]=min(dp[S|(1<<(i-1))],dp[S]+1);
for(int j=i+1;j<=n;j++)
{
dp[S|f[i][j]]=min(dp[S|f[i][j]],dp[S]+1);
}
}
}
}
printf("%d\n",dp[(1<<n)-1]);
}
}