description: An identity permutation of length n is an array [1, 2, 3, ..., n].
  
  We performed the following operations to an identity permutation of length n:
  
    * firstly, we cyclically shifted it to the right by k positions, where k is unknown to you (the only thing you know is that 0 ≤ k ≤ n - 1). When an array is cyclically shifted to the right by k positions, the resulting array is formed by taking k last elements of the original array (without changing their relative order), and then appending n - k first elements to the right of them (without changing relative order of the first n - k elements as well). For example, if we cyclically shift the identity permutation of length 6 by 2 positions, we get the array [5, 6, 1, 2, 3, 4]; 
    * secondly, we performed the following operation at most m times: pick any two elements of the array and swap them. 
  
  
  
  You are given the values of n and m, and the resulting array. Your task is to find all possible values of k in the cyclic shift operation.
  
  Input
  
  The first line contains one integer t (1 ≤ t ≤ 10^5) — the number of test cases.
  
  Each test case consists of two lines. The first line contains two integers n and m (3 ≤ n ≤ 3 ⋅ 10^5; 0 ≤ m ≤ n/3).
  
  The second line contains n integers p_1, p_2, ..., p_n (1 ≤ p_i ≤ n, each integer from 1 to n appears in this sequence exactly once) — the resulting array.
  
  The sum of n over all test cases does not exceed 3 ⋅ 10^5.
  
  Output
  
  For each test case, print the answer in the following way:
  
    * firstly, print one integer r (0 ≤ r ≤ n) — the number of possible values of k for the cyclic shift operation; 
    * secondly, print r integers k_1, k_2, ..., k_r (0 ≤ k_i ≤ n - 1) — all possible values of k in increasing order. 
  
  Example
  
  Input
  
  
  4
  4 1
  2 3 1 4
  3 1
  1 2 3
  3 1
  3 2 1
  6 0
  1 2 3 4 6 5
  
  
  Output
  
  
  1 3
  1 0
  3 0 1 2
  0
  
  Note
  
  Consider the example: 
  
    * in the first test case, the only possible value for the cyclic shift is 3. If we shift [1, 2, 3, 4] by 3 positions, we get [2, 3, 4, 1]. Then we can swap the 3-rd and the 4-th elements to get the array [2, 3, 1, 4]; 
    * in the second test case, the only possible value for the cyclic shift is 0. If we shift [1, 2, 3] by 0 positions, we get [1, 2, 3]. Then we don't change the array at all (we stated that we made at most 1 swap), so the resulting array stays [1, 2, 3]; 
    * in the third test case, all values from 0 to 2 are possible for the cyclic shift: 
      * if we shift [1, 2, 3] by 0 positions, we get [1, 2, 3]. Then we can swap the 1-st and the 3-rd elements to get [3, 2, 1]; 
      * if we shift [1, 2, 3] by 1 position, we get [3, 1, 2]. Then we can swap the 2-nd and the 3-rd elements to get [3, 2, 1]; 
      * if we shift [1, 2, 3] by 2 positions, we get [2, 3, 1]. Then we can swap the 1-st and the 2-nd elements to get [3, 2, 1]; 
    * in the fourth test case, we stated that we didn't do any swaps after the cyclic shift, but no value of cyclic shift could produce the array [1, 2, 3, 4, 6, 5]. 
solution: 			/*
  			TO LEARN
  			1-segment trees
  			2-euler tour
  		
  			*/
  			/*
  			TO SOLVE 
  			uva 1103
  			codeforces 722 kavi on pairing duty
  			*/
  			/*
  			bit manipulation shit
  			1-Computer Systems: A Programmer's Perspective
  			2-hacker's delight
  			3-(02-03-bits-ints)
  			4-machine-basics
  			5-Bits Manipulation tutorialspoint
  			*/
  			/*
  			TO WATCH
  			1-what is bitmasking by kartik arora youtube
  			*/
  			            import java.util.*;
  					    import java.math.*;
  					    import java.io.*; 
  					    import java.util.stream.Collectors;
  
  					       public class A{
  					     
  					  static InputStream inputStream = System.in;
  			            static FastScanner scan=new FastScanner();
  					     public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
  	static int n;
  	static int check(int arr1[],int arr2[])
  	{
  		int pos[]=new int[n];
  		for(int i=0;i<n;i++)
  			pos[arr1[i]]=i;
  		int edges[]=new int[n];
  		for(int i=0;i<n;i++)
  		{
  			edges[pos[arr2[i]]]=i;
  		}
  		boolean vis[]=new boolean[n];
  		int res=0;
  		for(int i=0;i<n;i++)
  		{
  			int k=i;
  			int size=0;
  			if(vis[i]||k==edges[k])
  				continue;
  			while(!vis[k])
  			{
  				//out.println("FUCK");
  				size++;
  				vis[k]=true;
  				k=edges[k];
  
  			}
  			if(size>0)
  				res+=(size-1);
  
  		
  
  	
  		}
  		return res;
  	}
  	static int [] RightRotate(int a[], int k)
  {
       
      // If rotation is greater
      // than size of array
      k = k % n;
   int tmp[]=new int[n];
      for(int i = 0; i < n; i++)
      {
         if(i < k)
         {
              
             // Printing rightmost
             // kth elements
            tmp[i]=a[n + i - k];
         }
         else
         {
              
             
             tmp[i]=a[i - k];
         }
      }
      return tmp;
  }
  
  
  
  				public static void main(String[] args)  throws Exception 
  			      {
  				
  						///scan=new FastScanner("cownomics.in");
  					//out = new PrintWriter("cownomics.out");
  					 
  					 /*
  					 currently doing 
  					 1-digit dp
  					 2-ds like fenwick and interval tree and sparse table 
  					 */
  					 /*
  					 READING 
  					 1-Everything About Dynamic Programming codeforces
  					 2-DYNAMIC PROGRAMMING: FROM NOVICE TO ADVANCED topcoder
  					 3-Introduction to DP with Bitmasking codefoces
  					 4-Bit Manipulation hackerearth
  					 5-read more about mobious and inculsion-exclusion 
  					 */
  		
  
  
  
  					    int tt=1;
  					tt=scan.nextInt();
  					int T=tt;
  					/*Map<Integer,Pair>map=new HashMap<Integer,Pair>();
  					for(int i=1;i<=333333334;i++)
  					{
  						map.put(i+2*i,new Pair(i,2*i));
  						map.put(i+(2*(i+1)),new Pair(i,i+1));
  						map.put(i+1+(2*i),new Pair(i+1,i));
  					}*/
  					int shoot=0;
  int first=-1;
  				 outer:while(tt-->0)
  					    {
  				n=scan.nextInt();
  				int m=scan.nextInt();
  				int arr[]=new int[n];
  				int pos[]=new int[n];
  				
  				for(int i=0;i<n;i++)
  				{
  					arr[i]=scan.nextInt()-1;
  					pos[arr[i]]=i;
  				}
  			
  
  				int orig[]=new int[n];
  				for(int i=0;i<n;i++){
  					orig[i]=i;
  
  				}
  				int cnt[]=new int[n];
  //for(int i=0;i<n;i++)
  //	cnt[((i-arr[i])%n+n)%n]++;
  int cnt2[]=new int[n];
  				for(int i=0;i<n;i++)
  				{
  					int p=pos[i];
  					if(i>p)
  					{
  						
  					
  						int to=n-i-1;
  						to+=(p+1);
  					//	if(i==2)
  					//		out.println(to);
  							//if(to==3)
  							//out.println(i+" "+p+" "+(p));
  						cnt2[to]++;
  					}
  					else if(p>i)
  					{
  						//if(p-i==3)
  							//out.println(i+" "+p);
  						cnt2[p-i]++;
  					}
  					else cnt2[0]++;
  				}
  				/*for(int i=0;i<n;i++)
  					out.print(cnt[i]+" ");
  				out.println();*/
  				//for(int i=0;i<n;i++)
  				//	out.print(cnt2[i]+" ");
  				//out.println();
  				//out.println(cnt[2]);
  				ArrayList<Integer>res=new ArrayList<Integer>();
  				if(check(orig,arr)<=m)
  					res.add(0);
  				for(int i=1;i<n;i++)
  				{
  					if(cnt2[i]*10>=n){
  					//	out.println("FUCK "+i);
  					int tmp[]=RightRotate(orig,i);
  					//if(i+1==3)
  					//	out.println(Arrays.toString(tmp));
  					if(check(tmp,arr)<=m){
  						//out.println(Arrays.toString(tmp));
  						res.add(i);
  					}
  				}
  				}
  
  				//shoot+=res.size()+1;
  				
  				out.println(res.size());
  				for(int r:res)
  					out.print(r+" ");
  
  				out.println();
  					    
  
  					   
  
  					   
  					    	
  					    	
  			}
  			   out.close();
  		}
  		  	 
  			 		  
  					   
  					
  					static class special{
  						boolean bool;
  						int n;
  						//int id;
  						special(boolean bool,int n)
  						{
  							this.bool=bool;
  							this.n=n;
  						}
  						@Override
  						    public int hashCode() {
  					                int hash = 7;
  		    hash = 31 * hash + (int) n;
  		   
  		    return hash;
  					            }
  					              @Override
  					            public boolean equals(Object o){
  					                if (o == this) return true;
  					                if (o.getClass() != getClass()) return false;
  					                special t = (special)o;
  					                return t.bool == bool && t.n == n;
  					            }
  					}
  
  					   
  					     static long binexp(long a,long n)
  					    {
  					        if(n==0)
  					            return 1;
  					        long res=binexp(a,n/2);
  					        if(n%2==1)
  					            return res*res*a;
  					        else 
  					            return res*res;
  					    }
  					     
  					    static long powMod(long base, long exp, long mod) {
  					           if (base == 0 || base == 1) return base;
  					           if (exp == 0) return 1;
  					           if (exp == 1) return (base % mod+mod)%mod;
  					           long R = (powMod(base, exp/2, mod) % mod+mod)%mod;
  					           R *= R;
  					           R %= mod;
  					           if ((exp & 1) == 1) {
  					               return (base * R % mod+mod)%mod;
  					           }
  					           else return (R %mod+mod)%mod;
  					       }
  					    static double dis(double x1,double y1,double x2,double y2)
  					    {
  					        return Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
  					    }
  					    static long mod(long x,long y)
  					        {
  					            if(x<0)
  					                x=x+(-x/y+1)*y;
  					            return x%y;
  					        }
  					     public static  long pow(long b, long e) {
  					                long r = 1;
  					                while (e > 0) {
  					                    if (e % 2 == 1) r = r * b ;
  					                    b = b * b;
  					                    e >>= 1;
  					                }
  					                return r;
  					            }
  					    private static void sort(long[] arr) {
  					            List<Long> list = new ArrayList<>();
  					            for (long object : arr) list.add(object);
  					            Collections.sort(list);
  					        //Collections.reverse(list);
  					            for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
  					        }
  					    private static void sort2(long[] arr) {
  					            List<Long> list = new ArrayList<>();
  					            for (Long object : arr) list.add(object);
  					            Collections.sort(list);
  					        Collections.reverse(list);
  					            for (int i = 0; i < list.size(); ++i) arr[i] = list.get(i);
  					        }
  					     static class FastScanner
  			{
  			    private int BS = 1 << 16;
  			    private char NC = (char) 0;
  			    private byte[] buf = new byte[BS];
  			    private int bId = 0, size = 0;
  			    private char c = NC;
  			    private double cnt = 1;
  			    private BufferedInputStream in;
  			 
  			    public FastScanner() {
  			        in = new BufferedInputStream(System.in, BS);
  			    }
  			 
  			    public FastScanner(String s) {
  			        try {
  			            in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
  			        } catch (Exception e) {
  			            in = new BufferedInputStream(System.in, BS);
  			        }
  			    }
  			 
  			    private char getChar() {
  			        while (bId == size) {
  			            try {
  			                size = in.read(buf);
  			            } catch (Exception e) {
  			                return NC;
  			            }
  			            if (size == -1) return NC;
  			            bId = 0;
  			        }
  			        return (char) buf[bId++];
  			    }
  			 
  			    public int nextInt() {
  			        return (int) nextLong();
  			    }
  			 
  			    public int[] nextInts(int N) {
  			        int[] res = new int[N];
  			        for (int i = 0; i < N; i++) {
  			            res[i] = (int) nextLong();
  			        }
  			        return res;
  			    }
  			 
  			    public long[] nextLongs(int N) {
  			        long[] res = new long[N];
  			        for (int i = 0; i < N; i++) {
  			            res[i] = nextLong();
  			        }
  			        return res;
  			    }
  			 
  			    public long nextLong() {
  			        cnt = 1;
  			        boolean neg = false;
  			        if (c == NC) c = getChar();
  			        for (; (c < '0' || c > '9'); c = getChar()) {
  			            if (c == '-') neg = true;
  			        }
  			        long res = 0;
  			        for (; c >= '0' && c <= '9'; c = getChar()) {
  			            res = (res << 3) + (res << 1) + c - '0';
  			            cnt *= 10;
  			        }
  			        return neg ? -res : res;
  			    }
  			 
  			    public double nextDouble() {
  			        double cur = nextLong();
  			        return c != '.' ? cur : cur + nextLong() / cnt;
  			    }
  			 
  			    public double[] nextDoubles(int N) {
  			        double[] res = new double[N];
  			        for (int i = 0; i < N; i++) {
  			            res[i] = nextDouble();
  			        }
  			        return res;
  			    }
  			 
  			    public String next() {
  			        StringBuilder res = new StringBuilder();
  			        while (c <= 32) c = getChar();
  			        while (c > 32) {
  			            res.append(c);
  			            c = getChar();
  			        }
  			        return res.toString();
  			    }
  			 
  			    public String nextLine() {
  			        StringBuilder res = new StringBuilder();
  			        while (c <= 32) c = getChar();
  			        while (c != '\n') {
  			            res.append(c);
  			            c = getChar();
  			        }
  			        return res.toString();
  			    }
  			 
  			    public boolean hasNext() {
  			        if (c > 32) return true;
  			        while (true) {
  			            c = getChar();
  			            if (c == NC) return false;
  			            else if (c > 32) return true;
  			        }
  			    }
  			}
  
  					     static class Pair implements Comparable<Pair>{
  					            public long x, y,z;
  					            public Pair(long x1, long y1,long z1) {
  					                x=x1;
  					                y=y1;
  					                z=z1;
  					            }
  					             public Pair(long x1, long y1) {
  					                x=x1;
  					                y=y1;
  					    
  					            }
  					            
  					            @Override
  					            public int hashCode() {
  					                return (int)(x + 31 * y);
  					            }
  					            public String toString() {
  					                return x + " " + y+" "+z;
  					            }
  					            @Override
  					            public boolean equals(Object o){
  					                if (o == this) return true;
  					                if (o.getClass() != getClass()) return false;
  					                Pair t = (Pair)o;
  					                return t.x == x && t.y == y&&t.z==z;
  					            }
  					    public int compareTo(Pair o)
  					    {
  					    	
  					    
  					    	return (int)((o.y-o.x)-(y-x));
  					     
  					        }
  					     
  					    }
  					    
  					    }
  
  					     
  