#include<bits/stdc++.h>usingnamespacestd;constintN=1000010;intn,c,ans;inta[N];structnode{intl,r;intv;}tr[N<<2];voidpushup(intu){tr[u].v=max(tr[u<<1].v,tr[u<<1|1].v);}voidbuild(intu,intl,intr){tr[u]={l,r};if(l==r){tr[u].v=c;return;}intmid=l+r>>1;build(u<<1,l,mid);build(u<<1|1,mid+1,r);pushup(u);}voidquery(intu,intx){if(tr[u].l==tr[u].r){if(tr[u].v==c){ans++;}tr[u].v-=x;return;}if(tr[u<<1].v>=x)query(u<<1,x);elsequery(u<<1|1,x);pushup(u);}voidsolve(){scanf("%d%d",&n,&c);for(inti=0;i<n;i++)scanf("%d",&a[i]);ans=0;// problem 1build(1,1,n);for(inti=0;i<n;i++)query(1,a[i]);// problem 2multiset<int>S;for(inti=0;i<n;i++){autoit=S.lower_bound(a[i]);if(it==S.end())S.insert(c-a[i]);else{intx=(*it)-a[i];S.erase(it);S.insert(x);}}cout<<ans<<' '<<S.size()<<endl;}intmain(){intT=1;cin>>T;while(T--)solve();return0;}