#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#define LL long long
#define INF 0x3f3f3f3f
using namespace std;
bool vis[25];
int b[21];
int n;
int ant;
void DFS(int pos,int a,int step)
{
if(pos < 0 || pos >=n || vis[pos])
return ;
if(ant <= step)
return ;
if(a%b[pos] == 0)
{
if(ant > step + 1)
ant = step + 1;
return ;
}
vis[pos] = true;
DFS(pos + 1, a%b[pos], step+1);
DFS(pos - 1, a%b[pos], step+1);
vis[pos] = false;
DFS(pos + 1,a,step);
}
int main()
{
int T;
scanf("%d",&T);
while(T--)
{
memset(vis,false,sizeof(vis));
bool flag = false;
int a;
ant = INF;
scanf("%d%d",&n,&a);
for(int i=0; i<n; i++)
{
scanf("%d",&b[i]);
if(a % b[i] == 0)
{
flag = true;
}
}
if(!flag)
{
DFS(0,a,0);
if(ant == INF)
cout<<-1<<endl;
else
cout<<ant<<endl;
}
else
{
cout<<1<<endl;
}
}
return 0;
}