#include
#include
using namespace std;
int main() {
// your code goes here
int t,n,q,a;
int x,y;
cin>>t;
for(int k=0; k<t; k++){
cin>>n>>q;
vector v;
for(int i=0; i<n; i++){
cin>>a;
v.push_back(a);
}
for(int i=0; i<q; i++){
int max_length=1;
int length=1;
cin>>x>>y;
v[x-1]=y;
for(int i=0; i<n-1; i++){
if(v[i]==v[i+1]){
length=1;
}else{
length++;
}
if(max_length<length){
max_length=length;
}
}
cout<<max_length<<endl;
}
}
return 0;
}
//what is wrong logic in above code