#include #include #include #include #include #include #include #include #include #include #include #include #include #define SZ(X) ((int)(X).size()) #define ALL(X) (X).begin(), (X).end() #define REP(I, N) for (int I = 0; I < (N); ++I) #define REPP(I, A, B) for (int I = (A); I < (B); ++I) #define RI(X) scanf("%d", &(X)) #define RII(X, Y) scanf("%d%d", &(X), &(Y)) #define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z)) #define DRI(X) int (X); scanf("%d", &X) #define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y) #define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z) #define RS(X) scanf("%s", (X)) #define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0) #define MP make_pair #define PB push_back #define MS0(X) memset((X), 0, sizeof((X))) #define MS1(X) memset((X), -1, sizeof((X))) #define LEN(X) strlen(X) #define PII pair #define VI vector #define VPII vector > #define PLL pair #define VPLL vector > #define F first #define S second typedef long long LL; using namespace std; const int MOD = 1e9+7; const int SIZE = 2e3+10; long double dp[SIZE]; int a[SIZE]; long double v[SIZE]; int main(){ v[1]=0; REPP(i,2,SIZE)v[i]=log2(i); CASET{ DRII(N,M); REP(i,M)RI(a[i]); if(M==1){ printf("%.0f\n",(double)floor(v[N]*1000000)); continue; } sort(a,a+M); { int bb=min(N,a[1]); REPP(i,a[0],bb)dp[i]=v[i+1]; } a[M]=N; REPP(i,1,M){ REPP(j,a[i],a[i+1]){ dp[j]=0; REPP(k,a[i-1],a[i]){ dp[j]=max(dp[j],dp[k]+v[j-k]); } } } printf("%.0f\n",(double)floor(dp[N-1]*1000000)); } return 0; }