Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

Description

Input

[Technical Specification]
1. T <= 50
2. 1 <= n, m <= 10^5
3. 1 <= ti <= 2*10^5, 1 <= i <= n
4. 1 <= q <= 2*10^5

Output

Sample Input

```1
5 5
1 2 3 5 6
1
2
3
4
5```

Sample Output

```4
4
4
4
7```

Solition

```预处理，看一下代码就会懂的。
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <queue>
#include <ctime>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <functional>
#define ms(a) memset(a,0,sizeof(a))
typedef long long ll;
const int INF = INT_MAX / 2;
const int MAXN = 200000 + 10;
using namespace std;
int a[MAXN];
int ans[MAXN];
int main()
{
int T;
cin >> T;
while (T--)
{
int n, m;
cin >> n >> m;
ms(a); ms(ans);
for (int i = 0; i < n; i++)
{
int t;
scanf("%d", &t);
a[t] = 1;
}
int j = n;
for (int i = 200001; i >= 0; i--)
{
if (!a[i])j = i;
ans[i] = j;
}
while (m--)
{
int t;
scanf("%d", &t);
printf("%d\n", ans[t]);
}
}
return 0;
}
```