看题目点我啊~

问一个数被至少多少个数取模后得0    注意得先排序啊啊啊啊啊啊啊啊

#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int t,b[30],n,minn;
int MIN(int a,int b)
{
    return a>b?b:a;
}
bool cmp(int a,int b)
{
    return a>b;
}
void dfs(int mod,int pos,int time)
{
    if(mod==0)
    {
        minn=MIN(minn,time);
        return;
    }
    if(pos==n) return;
    dfs(mod%b[pos+1],pos+1,time+1);
    dfs(mod,pos+1,time);
}
int main()
{
    //freopen("cin.txt","r",stdin);
    while(~scanf("%d",&t))
    {
        int a;
        while(t--)
        {
            scanf("%d%d",&n,&a);
            for(int i=1;i<=n;i++) scanf("%d",&b[i]);
            sort(b+1,b+1+n,cmp);
            minn=50;
            dfs(a,0,0);
            if(minn==50) printf("-1\n");
            else printf("%d\n",minn);
        }
    }
    return 0;
}