Help to solve Minimum Deletion RD19

Hi there,
I am new in this forum, so please help me with your suggestions…
Earlier today I was trying to solve the problem under “Practice>Beginner” named “Minimum Deletion” tag:RD19
I know it’s a smart way to solve this by finding GCD of the numbers but I tried something else. The GCD of the numbers suppose to be 1 if all of them are PRIME numbers, so we just wanna know how many numbers are not prime in the given nembers…
So I write the code which is looking fine to me but after submission it says “Wrong answer”
I will appreciate if someone help me to find the bug in my code…

//RD19
//Unsolved
#include<stdio.h>
#include<math.h>
int test_case(int ara[], int b);
int main()
{
	int a,b,d,e;
	int i,j;
	int x,y;
	scanf("%d",&a);
	for(j=0;j<a;j++)
	{
		scanf("%d",&b);
	  	int ara[b];
	  	for(i=0;i<b;i++)
		{
			scanf("%d",&ara[i]);
		}
			x=test_case(ara,b);
	if(x==1)
	{
		x=-1;
		printf("%d\n",x);
	}
	else
	{
	printf("%d\n",x);
	}
	}
	return 0;
}
int test_case(int ara[], int b)
{
	int i,j,k=0,x=0,y; 
	for(i=0;i<b;i++)
	{
		if(ara[i]==1||ara[i]==2)
		{
			x=0;
		}
		else if(ara[i]%2==0)
		{
			x=1;
		}
		y=sqrt(ara[i]);
		for(j=3;j<=y;j=j+2)
		{
			if(ara[i]%j==0)
			{
				x=1;
			}
			
		}
		if(x==1)
		{
			k=k+1;
		}
	}
	return k;	
}

Consider the test case 6, 8, 9 the answer should be 0 as you don’t need to delete any numbers to achieve a GCD of 1 altogether. So this is the case of all numbers being Coprime.

Thank you so much for your help…