#include #include #include #include #include using namespace std; #define mem(a,t) memset(a,t,sizeof(a)) #define N 1005 #define LL __int64 const LL mod=998244353; const double eps=1e-5; int a[N],b[N][N]; int main() { int i,j,n,q; while(scanf("%d%d",&n,&q)!=-1) { for(i=1;i<=n;i++) { scanf("%d",&a[i]); } mem(b,0); for(i=1;ia[j]) t++; b[i][j]=t; } } for(j=n;j>=1;j--) { for(i=n-1;i>=1;i--) { if(i