//重做这个题完全是为了使用res.erase();
以前比赛的时候基本不敢用, 事实证明是可以A题的;不能res.erase(res.end());
不知为何。。。
#include<cstdio>
#include<iostream>
#include<vector>
#include<cstring>
#include<string.h>
#include<algorithm>
using namespace std;
vector<int> res;
int main()
{
int n;
int W;
int T;
cin >>T;
while(T--)
{
res.clear();
scanf("%d%d", &n, &W);
for(int i = 0; i <n; ++i)
{
int t;
scanf("%d", &t);
res.push_back(t);
}
sort(res.begin(), res.end());
int cnt = 0;
while(!res.empty())
{
++cnt;
vector<int> :: iterator it = upper_bound(res.begin()+1, res.end(), W-res[0]) - 1;
if(it != res.begin()) { res.erase(it);res.erase(res.begin());}
else res.erase(res.begin());
}
cout << cnt << endl;
if(T) printf("\n");
}
}