#include #include #include #include #include using namespace std; #define ll __int64 #define maxn 30 #define INF 99999999 int a[maxn]; int ans; void dfs (int x,int loc,int num){ if (num>ans) return ; if (x==0) {ans=min(ans,num);return ;} for (int i=loc-1;i>=1;i--){ if (x>=a[i]) dfs(x%a[i],i,num+1); } } int main() { int t,x,n; scanf("%d",&t); while (t--){ scanf("%d%d",&n,&x); for (int i=1;i<=n;i++) scanf("%d",&a[i]); sort(a+1,a+1+n); ans=INF; dfs(x,n+1,0); if (ans==INF) printf("-1\n"); else printf("%d\n",ans); } return 0; }