import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int q = in.nextInt();
            for (int i = 0; i < q; i++) {
                int h = in.nextInt();
                int n = in.nextInt();
                ArrayList<Integer> lst = new ArrayList<>();

                for (int j = 0; j < n; j++) {
                    int p = in.nextInt();
                    lst.add(p);
                }
                lst.add(0);

                int counter = 0;
                int cur = lst.get(0);
                for (int j = 1; j < n; j++) {
                    if (cur < 3) break;

                    if (lst.get(j) >= cur) continue;
                    if (lst.get(j) != cur - 1) cur = lst.get(j) + 1;

                    if (lst.get(j + 1) + 2 < cur) {
                        cur -= 2;
                        counter++;
                    } else cur = lst.get(j + 1);
                }
                out.println(counter);
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int q = in.nextInt();
            for (int i = 0; i < q; i++) {
                int h = in.nextInt();
                int n = in.nextInt();
                ArrayList<Integer> lst = new ArrayList<>();

                for (int j = 0; j < n; j++) {
                    int p = in.nextInt();
                    lst.add(p);
                }
                lst.add(0);

                int counter = 0;
                int cur = lst.get(0);
                for (int j = 1; j < n; j++) {
                    if (cur < 3) break;

                    if (lst.get(j) >= cur) continue;
                    if (lst.get(j) != cur - 1) cur = lst.get(j) + 1;

                    if (lst.get(j + 1) + 2 < cur) {
                        int temp = (cur - lst.get(j + 1) - 1) / 2;
                        counter += temp;
                        cur -= temp * 2;
                    } else cur = lst.get(j + 1);
                }
                out.println(counter);
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void close() {
            writer.close();
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.ArrayList;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        OutputWriter out = new OutputWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, OutputWriter out) {
            int q = in.nextInt();
            for (int i = 0; i < q; i++) {
                int h = in.nextInt();
                int n = in.nextInt();
                ArrayList<Integer> lst = new ArrayList<>();

                for (int j = 0; j < n; j++) {
                    int p = in.nextInt();
                    lst.add(p);
                }
                lst.add(0);

                int counter = 0;
                int cur = lst.get(0);
                for (int j = 1; j < n; j++) {
                    if (lst.get(j) >= cur) continue;
                    if (cur < 3) break;
                    if (lst.get(j) != cur - 1) cur = lst.get(j) + 1;
                    if (cur < 3) break;

                    if (lst.get(j + 1) + 2 < cur) {
                        int temp = (cur - lst.get(j + 1) - 1) / 2;
                        counter += temp;
                        cur = StrictMath.max(cur - temp * 2, lst.get(j + 1));
                    } else cur = lst.get(j + 1);
                }
                out.println(counter);
            }
        }

    }

    static class OutputWriter {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream) {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
        }

        public OutputWriter(Writer writer) {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects) {
            for (int i = 0; i < objects.length; i++) {
                if (i != 0) {
                    writer.print(' ');
                }
                writer.print(objects[i]);
            }
        }

        public void close() {
            writer.close();
        }

        public void print(int i) {
            writer.print(i);
        }

        public void println(int i) {
            writer.println(i);
        }

    }

    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
        private InputReader.SpaceCharFilter filter;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public boolean isSpaceChar(int c) {
            if (filter != null) {
                return filter.isSpaceChar(c);
            }
            return isWhitespace(c);
        }

        public static boolean isWhitespace(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        public interface SpaceCharFilter {
            public boolean isSpaceChar(int ch);

        }

    }
}


import java.io.*;
import java.util.TreeSet;

/**
 * Created by himanshubhardwaj on 08/10/19.
 */
public class C {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        PrintWriter pw = new PrintWriter(System.out);

        while (t-- > 0) {
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int n = Integer.parseInt(str[1]);

            str = br.readLine().split(" ");
            int[] positions = new int[str.length];
            TreeSet<Integer> treeSet = new TreeSet<>();

            for (int i = 0; i < positions.length; i++) {
                treeSet.add(Integer.parseInt(str[i]));
            }

            pw.append(getNumSetps(h, treeSet) + "\n");
        }
        pw.flush();
    }

    private static int getNumSetps(int h, TreeSet<Integer> positions) {
        int currentPos = positions.last();
        positions.remove(currentPos);
        int crystalRequired = 0;

        if (positions.size() == 0) {
            return 0;
        }

        while (currentPos > 2 && positions.size() > 0) {
            positions.remove(currentPos);

            Integer nextCliff = positions.lower(currentPos);
            if (nextCliff == null) {
                break;
            }

            if ((currentPos - nextCliff) > 1) {
                positions.remove(currentPos);
                currentPos = currentPos - 1;
            } else {
                Integer nextNextCliff = positions.lower(nextCliff);

                if (nextNextCliff == null) {
                    crystalRequired++;
                    break;
                }

                if ((nextCliff - nextNextCliff) == 1) {
                    positions.remove(currentPos);
                    positions.remove(nextCliff);
                    positions.remove(nextNextCliff);
                    currentPos = nextNextCliff;
                } else {
                    positions.remove(currentPos);
                    positions.remove(nextCliff);
                    currentPos = nextCliff - 1;
                    crystalRequired++;
                }
            }

        }

        return crystalRequired;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.TreeSet;

/**
 * Created by himanshubhardwaj on 08/10/19.
 */
public class C {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        PrintWriter pw = new PrintWriter(System.out);

        while (t-- > 0) {
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int n = Integer.parseInt(str[1]);

            str = br.readLine().split(" ");
            int[] positions = new int[str.length];
            TreeSet<Integer> treeSet = new TreeSet<>();

            for (int i = 0; i < positions.length; i++) {
                treeSet.add(Integer.parseInt(str[i]));
            }

            pw.append(getNumSetps(h, treeSet) + "\n");
        }
        pw.flush();
    }

    private static int getNumSetps(int h, TreeSet<Integer> positions) {
        int currentPos = positions.last();
        int crystalRequired = 0;

        if (positions.size() == 1) {
            return 0;
        }

        while (currentPos > 2 && positions.size() > 0) {
            positions.remove(currentPos);

            Integer nextCliff = positions.lower(currentPos);
            if (nextCliff == null) {
                break;
            }

            if ((currentPos - nextCliff) > 1) {
                currentPos = currentPos - 1;
            } else {
                Integer nextNextCliff = positions.lower(nextCliff);

                if (nextNextCliff == null) {
                    crystalRequired++;
                    break;
                }

                if ((nextCliff - nextNextCliff) == 1) {
                    positions.remove(nextCliff);
                    currentPos = nextNextCliff;
                } else {
                    positions.remove(nextCliff);
                    currentPos = nextCliff - 1;
                    crystalRequired++;
                }
            }

        }

        return crystalRequired;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.TreeSet;

/**
 * Created by himanshubhardwaj on 08/10/19.
 */
public class C {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        PrintWriter pw = new PrintWriter(System.out);

        while (t-- > 0) {
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int n = Integer.parseInt(str[1]);

            str = br.readLine().split(" ");
            int[] positions = new int[str.length];
            TreeSet<Integer> treeSet = new TreeSet<>();

            for (int i = 0; i < positions.length; i++) {
                treeSet.add(Integer.parseInt(str[i]));
            }

            pw.append(getNumSetps(h, treeSet) + "\n");
        }
        pw.flush();
    }

    private static int getNumSetps(int h, TreeSet<Integer> positions) {
        int currentPos = positions.last();
        int crystalRequired = 0;

        if (positions.size() == 1) {
            return 0;
        }

        while (currentPos > 2 && positions.size() > 0) {
            positions.remove(currentPos);

            Integer nextCliff = positions.lower(currentPos);
            if (nextCliff == null) {
                break;
            }

            if ((currentPos - nextCliff) > 1) {
                currentPos = nextCliff + 1;
            } else {
                Integer nextNextCliff = positions.lower(nextCliff);

                if (nextNextCliff == null) {
                    crystalRequired++;
                    break;
                }

                if ((nextCliff - nextNextCliff) == 1) {
                    positions.remove(nextCliff);
                    currentPos = nextNextCliff;
                } else {
                    positions.remove(nextCliff);
                    currentPos = nextNextCliff + 1;
                    crystalRequired++;
                }
            }

        }

        return crystalRequired;
    }
}


import java.io.*;
import java.util.TreeSet;

/**
 * Created by himanshubhardwaj on 08/10/19.
 */
public class C {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        PrintWriter pw = new PrintWriter(System.out);

        while (t-- > 0) {
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int n = Integer.parseInt(str[1]);

            str = br.readLine().split(" ");
            int[] positions = new int[str.length];
            TreeSet<Integer> treeSet = new TreeSet<>();

            for (int i = 0; i < positions.length; i++) {
                treeSet.add(Integer.parseInt(str[i]));
            }

            pw.append(getNumSetps(h, treeSet) + "\n");
        }
        pw.flush();
    }

    private static int getNumSetps(int h, TreeSet<Integer> positions) {
        int currentPos = positions.last();
        positions.remove(currentPos);
        int crystalRequired = 0;

        if (positions.size() == 1) {
            return 0;
        }

        while (currentPos > 2 && positions.size() > 0) {

            int nextCliff = positions.lower(currentPos);
            if ((currentPos - nextCliff) > 1) {
                positions.remove(currentPos);
                currentPos = currentPos - 1;
            } else {
                int nextNextCliff = positions.lower(nextCliff);
                if ((nextCliff - nextNextCliff) == 1) {
                    positions.remove(currentPos);
                    positions.remove(nextCliff);
                    positions.remove(nextNextCliff);
                    currentPos = nextNextCliff;
                } else {
                    positions.remove(currentPos);
                    positions.remove(nextCliff);
                    currentPos = nextCliff - 1;
                    crystalRequired++;
                }
            }

        }

        return crystalRequired;
    }
}


import java.io.*;
import java.util.TreeSet;

/**
 * Created by himanshubhardwaj on 08/10/19.
 */
public class C {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int t = Integer.parseInt(br.readLine());
        PrintWriter pw = new PrintWriter(System.out);

        while (t-- > 0) {
            String[] str = br.readLine().split(" ");
            int h = Integer.parseInt(str[0]);
            int n = Integer.parseInt(str[1]);

            str = br.readLine().split(" ");
            int[] positions = new int[str.length];
            TreeSet<Integer> treeSet = new TreeSet<>();

            for (int i = 0; i < positions.length; i++) {
                treeSet.add(Integer.parseInt(str[i]));
            }

            pw.append(getNumSetps(h, treeSet) + "\n");
        }
        pw.flush();
    }

    private static int getNumSetps(int h, TreeSet<Integer> positions) {
        int currentPos = positions.last();
        positions.remove(currentPos);
        int crystalRequired = 0;

        if (positions.size() == 1) {
            return 0;
        }

        while (currentPos > 2 && positions.size() > 0) {

            Integer nextCliff = positions.lower(currentPos);
            if (nextCliff == null) {
                break;
            }

            if ((currentPos - nextCliff) > 1) {
                positions.remove(currentPos);
                currentPos = currentPos - 1;
            } else {
                Integer nextNextCliff = positions.lower(nextCliff);

                if (nextNextCliff == null) {
                    crystalRequired++;
                    break;
                }

                if ((nextCliff - nextNextCliff) == 1) {
                    positions.remove(currentPos);
                    positions.remove(nextCliff);
                    positions.remove(nextNextCliff);
                    currentPos = nextNextCliff;
                } else {
                    positions.remove(currentPos);
                    positions.remove(nextCliff);
                    currentPos = nextCliff - 1;
                    crystalRequired++;
                }
            }

        }

        return crystalRequired;
    }
}


import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main
{
   static long mod=(long)(1e+9 + 7);
   //static long mod=(long)998244353;

   static int[] sieve;
   static ArrayList<Integer> primes;
   static long min=Long.MAX_VALUE;

   public static void main(String[] args) throws java.lang.Exception
   {
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);

	     int t=s.nextInt();
	     StringBuilder fans=new StringBuilder("");

	     while(t>0)
	    	 {
	    		 long f[]=new long[100005];

	    		 long h=s.nextLong();
	    		 int n=s.nextInt();

	    		 long a[]=new long[n+1];
	    		 for(int i=0;i<n;i++)
	    			 a[i]=s.nextLong();
	    		 a[n]=0;

	    		 if(n==1) System.out.println("0");
	    		 else
	    			 {
	    				 long cur=a[1]+1;
	    				 long ans=0;
	    				 for(int i=1;i<n;)
	    					 {
	    						 //if(cur-a[i]==1)
	    							 //{
	    								 if(cur-a[i+1]<=2)
	    									 {
	    										 i+=2;
	    										 if(i<n)
	    										    cur=a[i]+1;
	    									 }
	    								 else
	    									 {
	    										 i++;
	    										 ans++;
	    										 cur=a[i]+1;
	    									 }
	    							// }
	    					 }
	    				 System.out.println(ans);
	    			 }
	    		 t--;
	    	 }
   }

static class fast {
	    private InputStream i;
		private byte[]  buf = new byte[1024];
		private int curChar;

		private int numChars;

		//Return floor log2n
		public static long log2(long bits) // returns 0 for bits=0
			{
			    int log = 0;
			    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
			    if( bits >= 256 ) { bits >>>= 8; log += 8; }
			    if( bits >= 16  ) { bits >>>= 4; log += 4; }
			    if( bits >= 4   ) { bits >>>= 2; log += 2; }
			    return log + ( bits >>> 1 );
			}

		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;
			   int n=a.length;

			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;

			   if(index==-1) return false;
			   i=index;

			   for(j=i+1;j<n && a[i]<a[j];j++);

			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;

			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }

			   return true;
		   }

		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;

			   }
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);
			   System.out.println(quotient+" "+remainder);
		   }

		public static void sieve(int size)
		{
			sieve=new int[size+1];

			primes=new ArrayList<Integer>();

			sieve[1]=1;

			for(int i=2;i*i<=size;i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
				 }
			}

			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}

		public static long pow(long n, long b, long MOD)
		   {
		       long x=1;long y=n;
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD);
		           b >>= 1;
		       }
		       return x;
		   }

		public static long mod_inv(long n,long mod)
		{
			return pow(n,mod-2,mod);
		}

		//Returns index of highest number less than or equal to key
		 public static int upper(long[] a,int length,long key)
		 {
			    int low = 0;
		        int high = length-1;
		        int ans=-1;

		        while (low <= high) {
		            int mid = (low + high) / 2;
		            if (key >= a[mid]) {
		                ans=mid;
		            	low = mid+1;
		            } else if(a[mid]>key){
		                high = mid - 1;
		            }
		        }
		        return ans;
		}

		//Returns index of least number greater than or equal to key
		 public static int lower(long[] a,int length,long key)
		 {
			    int low = 0;
		        int high = length-1;
		        int ans=-1;

		        while (low <= high) {
		            int mid = (low + high) / 2;
		            if (key<=a[mid]) {
		                ans=mid;
		            	high = mid-1;
		            }
		            else{
		            		low=mid+1;
		            	}
		        }
		        return ans;
		}

		public long gcd(long r,long ans)
		{
			if(r==0) return ans;
			return gcd(ans%r,r);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
}


import java.io.*;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main
{
   static long mod=(long)(1e+9 + 7);
   //static long mod=(long)998244353;

   static int[] sieve;
   static ArrayList<Integer> primes;
   static long min=Long.MAX_VALUE;

   public static void main(String[] args) throws java.lang.Exception
   {
	     fast s = new fast();
	     PrintWriter out=new PrintWriter(System.out);

	     int t=s.nextInt();
	     StringBuilder fans=new StringBuilder("");

	     while(t>0)
	    	 {
	    		 long f[]=new long[100005];

	    		 long h=s.nextLong();
	    		 int n=s.nextInt();

	    		 long a[]=new long[n+1];
	    		 for(int i=0;i<n;i++)
	    			 a[i]=s.nextLong();
	    		 a[n]=0;

	    		 if(n==1) System.out.println("0");
	    		 else
	    			 {
	    				 long cur=a[1]+1;
	    				 long ans=0;
	    				 for(int i=1;i<n;)
	    					 {
	    						 //if(cur-a[i]==1)
	    							 //{
	    								 if(cur-a[i+1]<=2)
	    									 {
	    										 i++;
	    										 cur=a[i];
	    										 i++;
	    									 }
	    								 else
	    									 {
	    										 i++;
	    										 ans++;
	    										 cur=a[i]+1;
	    									 }
	    							// }
	    					 }
	    				 System.out.println(ans);
	    			 }
	    		 t--;
	    	 }
   }

static class fast {
	    private InputStream i;
		private byte[]  buf = new byte[1024];
		private int curChar;

		private int numChars;

		//Return floor log2n
		public static long log2(long bits) // returns 0 for bits=0
			{
			    int log = 0;
			    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
			    if( bits >= 256 ) { bits >>>= 8; log += 8; }
			    if( bits >= 16  ) { bits >>>= 4; log += 4; }
			    if( bits >= 4   ) { bits >>>= 2; log += 2; }
			    return log + ( bits >>> 1 );
			}

		public static boolean next_permutation(int a[])
		   {
			   int i=0,j=0;int index=-1;
			   int n=a.length;

			   for(i=0;i<n-1;i++)
				   if(a[i]<a[i+1]) index=i;

			   if(index==-1) return false;
			   i=index;

			   for(j=i+1;j<n && a[i]<a[j];j++);

			   int temp=a[i];
			   a[i]=a[j-1];
			   a[j-1]=temp;

			   for(int p=i+1,q=n-1;p<q;p++,q--)
			   {
				   temp=a[p];
				   a[p]=a[q];
				   a[q]=temp;
			   }

			   return true;
		   }

		public static void division(char ch[],int divisor)
		   {
			   int div=Character.getNumericValue(ch[0]); int mul=10;int remainder=0;
			   StringBuilder quotient=new StringBuilder("");
			   for(int i=1;i<ch.length;i++)
			   {
				   div=div*mul+Character.getNumericValue(ch[i]);
				   if(div<divisor) {quotient.append("0");continue;}
				   quotient.append(div/divisor);
				   div=div%divisor;mul=10;

			   }
			   remainder=div;
			   while(quotient.charAt(0)=='0')quotient.deleteCharAt(0);
			   System.out.println(quotient+" "+remainder);
		   }

		public static void sieve(int size)
		{
			sieve=new int[size+1];

			primes=new ArrayList<Integer>();

			sieve[1]=1;

			for(int i=2;i*i<=size;i++)
			{
				if(sieve[i]==0)
				 {
					for(int j=i*i;j<size;j+=i) {sieve[j]=1;}
				 }
			}

			for(int i=2;i<=size;i++)
			{
				if(sieve[i]==0) primes.add(i);
			}
		}

		public static long pow(long n, long b, long MOD)
		   {
		       long x=1;long y=n;
		       while(b > 0)
		       {
		           if(b%2 == 1)
		           {
		               x=x*y;
		               if(x>MOD) x=x%(MOD);
		           }
		           y = y*y;
		           if(y>MOD) y=y%(MOD);
		           b >>= 1;
		       }
		       return x;
		   }

		public static long mod_inv(long n,long mod)
		{
			return pow(n,mod-2,mod);
		}

		//Returns index of highest number less than or equal to key
		 public static int upper(long[] a,int length,long key)
		 {
			    int low = 0;
		        int high = length-1;
		        int ans=-1;

		        while (low <= high) {
		            int mid = (low + high) / 2;
		            if (key >= a[mid]) {
		                ans=mid;
		            	low = mid+1;
		            } else if(a[mid]>key){
		                high = mid - 1;
		            }
		        }
		        return ans;
		}

		//Returns index of least number greater than or equal to key
		 public static int lower(long[] a,int length,long key)
		 {
			    int low = 0;
		        int high = length-1;
		        int ans=-1;

		        while (low <= high) {
		            int mid = (low + high) / 2;
		            if (key<=a[mid]) {
		                ans=mid;
		            	high = mid-1;
		            }
		            else{
		            		low=mid+1;
		            	}
		        }
		        return ans;
		}

		public long gcd(long r,long ans)
		{
			if(r==0) return ans;
			return gcd(ans%r,r);
		}
		public fast() {
			this(System.in);
		}
		public fast(InputStream is) {
			i = is;
		}
		public int read() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = i.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
		public String nextLine() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isEndOfLine(c));
			return res.toString();
		}
		public String nextString() {
     		int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = read();
			} while (!isSpaceChar(c));
			return res.toString();
		}
		public long nextLong() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public int nextInt() {
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = read();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
		public boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}

	}
}


import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = sc.nextInt();

        for (int i=0; i<q; i++) {
            int h = sc.nextInt();
            int n =sc.nextInt();

            int[] a = new int[n];

            for (int j=0; j<n; j++) {
                a[j] = sc.nextInt();
            }

            int cost = 0;
            int currentHeight = h;
            int currentIndex = 1;

            while (currentHeight > 0 && currentIndex <= n-1) {
                while (a[currentIndex] < currentHeight - 1) {
                    currentHeight--;
                }
                if (currentIndex > n-2) {
                    if (a[n-1] > 1) {
                        cost++;
                    }
                    break;
                }
                if (a[currentIndex + 1] < currentHeight - 2) {
                    cost++;
                    currentHeight--;
                    currentIndex++;
                } else {
                    currentHeight -= 2;
                    currentIndex += 2;
                }
            }
            out.println(cost);
        }

        out.close();
    }

    public static PrintWriter out;

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}


import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = sc.nextInt();

        for (int i=0; i<q; i++) {
            int h = sc.nextInt();
            int n =sc.nextInt();

            int[] a = new int[n];

            for (int j=0; j<n; j++) {
                a[j] = sc.nextInt();
            }

            int cost = 0;
            int currentHeight = h;
            int currentIndex = 1;

            while (currentHeight > 0 && currentIndex <= n-2) {
                while (a[currentIndex] < currentHeight - 1) {
                    currentHeight--;
                }
                if (currentIndex > n-2) {
                    cost++;
                    break;
                }
                if (a[currentIndex + 1] < currentHeight - 2) {
                    cost++;
                    currentHeight--;
                    currentIndex++;
                } else {
                    currentHeight -= 2;
                    currentIndex += 2;
                }
            }
            out.println(cost);
        }

        out.close();
    }

    public static PrintWriter out;

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}


import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = sc.nextInt();

        for (int i=0; i<q; i++) {
            int h = sc.nextInt();
            int n =sc.nextInt();

            int[] a = new int[n];

            for (int j=0; j<n; j++) {
                a[j] = sc.nextInt();
            }

            int cost = 0;
            int currentHeight = h;
            int currentIndex = 1;

            while (currentHeight > 0 && currentIndex <= n-1) {
                currentHeight = a[currentIndex] + 1;
                if (currentIndex > n-2) {
                    if (a[n-1] > 1) {
                        cost++;
                    }
                    break;
                }
                if (a[currentIndex + 1] < currentHeight - 2) {
                    cost++;
                    currentHeight--;
                    currentIndex++;
                } else {
                    currentHeight -= 2;
                    currentIndex += 2;
                }
            }
            out.println(cost);
        }

        out.close();
    }

    public static PrintWriter out;

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}


import java.io.*;
import java.util.StringTokenizer;

public class Main {

    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = sc.nextInt();

        for (int i=0; i<q; i++) {
            int h = sc.nextInt();
            int n =sc.nextInt();

            int[] a = new int[n];

            for (int j=0; j<n; j++) {
                a[j] = sc.nextInt();
            }

            int cost = 0;
            int currentHeight = h;
            int currentIndex = 1;

            while (currentHeight > 0 && currentIndex <= n-1) {
                while (a[currentIndex] < currentHeight - 1) {
                    currentHeight--;
                }
                if (currentIndex > n-2) {
                    cost++;
                    break;
                }
                if (a[currentIndex + 1] < currentHeight - 2) {
                    cost++;
                    currentHeight--;
                    currentIndex++;
                } else {
                    currentHeight -= 2;
                    currentIndex += 2;
                }
            }
            out.println(cost);
        }

        out.close();
    }

    public static PrintWriter out;

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
}


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class AN3 {
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int t=scan.nextInt();
        while(t-->0){
            long h=scan.nextLong();
            int n=scan.nextInt();
            int[] arr=new int[n];
            for (int i = 0; i < n; i++) {
                arr[i]=scan.nextInt();
            }
//            Map<Integer,Integer> m=new HashMap<>();
//            m.put(arr[n-1],0);
//            m.put(arr[n-1]-1,1);
//            m.put(1,0);
//            m.put(2,0);
//            int last=arr[n-1];
//            for(int i=2;i<n;i++){
//                m.put(arr[n-1-i],);
//            }
            int ans=0;
            if(h>2) {
                for(int i=1;i<n-1;i++){
                    if(arr[i]-arr[i+1]>1){
                        ans++;
                    }
                    else{
                        i++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


// package com.company;
import java.util.*;
import java.lang.*;
import java.io.*;
//****Use Integer Wrapper Class for Arrays.sort()****
public class AN3 {
    public static void main(String[] Args){
        FastReader scan=new FastReader();
        int t=scan.nextInt();
        while(t-->0){
            long h=scan.nextLong();
            int n=scan.nextInt();
            int[] arr=new int[n+1];
            for (int i = 0; i < n; i++) {
                arr[i]=scan.nextInt();
            }
            arr[n]=0;
//            Map<Integer,Integer> m=new HashMap<>();
//            m.put(arr[n-1],0);
//            m.put(arr[n-1]-1,1);
//            m.put(1,0);
//            m.put(2,0);
//            int last=arr[n-1];
//            for(int i=2;i<n;i++){
//                m.put(arr[n-1-i],);
//            }
            int ans=0;
            if(h>2) {
                for(int i=1;i<n;i++){
                    if(arr[i]-arr[i+1]>1){
                        ans++;
                    }
                    else{
                        i++;
                    }
                }
            }
            System.out.println(ans);
        }
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

}


// This template code suggested by KT BYTE Computer Science Academy
//   for use in reading and writing files for USACO problems.

// https://content.ktbyte.com/problem.java

import java.util.*;
import java.io.*;

public class StandardFree2play {

    static StreamTokenizer in;

    static int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    public static void main(String[] args) throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = nextInt();

        for (int i = 0; i < q; i++) {
            int h = nextInt();
            int n = nextInt();

            HashSet<Integer> outs = new HashSet<>();

            for (int j = 0; j < n; j++) {
                outs.add(nextInt());
            }

            int result = 0;

            while (h > 0) {
                if (outs.contains(h - 1)) {
                    if (outs.contains(h - 2)) {
                        h -= 2;
                    }

                    else if (h - 2 <= 0) break;

                    else {
                        result++;
                        h -= 2;
                    }
                }

                else h--;
            }

            out.println(result);
        }

        out.close();
    }
}


// This template code suggested by KT BYTE Computer Science Academy
//   for use in reading and writing files for USACO problems.

// https://content.ktbyte.com/problem.java

import java.util.*;
import java.io.*;

public class StandardFree2play {

    static StreamTokenizer in;

    static int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    public static void main(String[] args) throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = nextInt();

        for (int i = 0; i < q; i++) {
            int h = nextInt();
            int n = nextInt();

            int[] arr = new int[n];

            for (int j = 0; j < n; j++) {
                arr[j] = nextInt();
            }

            int result = 0;
            int indexArr = 1;

            while (h > 1) {
                if (indexArr == n) break;
                if (arr[indexArr] == h-1) {
                    if (h <= 2) break;

                    if (indexArr+1 == n) {
                        result++;
                        break;
                    }

                    if (arr[indexArr+1] == h-2) {
                        h -= 2;
                        indexArr += 2;
                    }

                    else {
                        result++;
                        h -= 2;
                        indexArr++;
                    }
                }

                else {
                    h = arr[indexArr] + 1;
                }
            }

            out.println(result);
        }

        out.close();
    }
}


// This template code suggested by KT BYTE Computer Science Academy
//   for use in reading and writing files for USACO problems.

// https://content.ktbyte.com/problem.java

import java.util.*;
import java.io.*;

public class StandardFree2play {

    static StreamTokenizer in;

    static int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    public static void main(String[] args) throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = nextInt();

        for (int i = 0; i < q; i++) {
            int h = nextInt();
            int n = nextInt();

            int[] arr = new int[n];

            for (int j = 0; j < n; j++) {
                arr[j] = nextInt();
            }

            int result = 0;
            int indexArr = 1;

            while (h > 1) {
                if (indexArr == n) break;
                if (arr[indexArr] == h-1) {
                    if (h <= 2) break;

                    if (arr[indexArr+1] == h-2) {
                        h -= 2;
                        indexArr += 2;
                    }

                    else {
                        result++;
                        h -= 2;
                        indexArr++;
                    }
                }

                else {
                    h = arr[indexArr] + 1;
                }
            }

            out.println(result);
        }

        out.close();
    }
}


// This template code suggested by KT BYTE Computer Science Academy
//   for use in reading and writing files for USACO problems.

// https://content.ktbyte.com/problem.java

import java.util.*;
import java.io.*;

public class StandardFree2play {

    static StreamTokenizer in;

    static int nextInt() throws IOException {
        in.nextToken();
        return (int) in.nval;
    }

    public static void main(String[] args) throws Exception {
        in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out));

        int q = nextInt();

        for (int i = 0; i < q; i++) {
            int h = nextInt();
            int n = nextInt();

            HashSet<Integer> outs = new HashSet<>();

            for (int j = 0; j < n; j++) {
                outs.add(nextInt());
            }

            int result = 0;

            while (h > 1) {
                if (outs.contains(h - 1)) {
                    if (outs.contains(h - 2)) {
                        h -= 2;
                    }

                    else if (h - 2 <= 0) break;

                    else {
                        result++;
                        h -= 2;
                    }
                }

                else h--;
            }

            out.println(result);
        }

        out.close();
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        int q = Integer.parseInt(br.readLine().trim());
        while (q-- > 0) {
            st = new StringTokenizer(br.readLine().trim());
            int h = Integer.parseInt(st.nextToken().trim());
            int n = Integer.parseInt(st.nextToken().trim());
            int[] plat = new int[n];
            st = new StringTokenizer(br.readLine().trim());
            for (int i = 0; i < n; i++) {
                plat[i] = Integer.parseInt(st.nextToken().trim());
            }
            int count = 0;
            int idx = 1;
            while (h > 2) {
                if (idx < n && plat[idx] < h - 1) {
                    h--;
                } else if (idx + 1 < n && plat[idx] == h - 1) {
                    if (plat[idx + 1] != h - 2) {
                        count++;
                    } else {
                        idx++;
                    }
                    h -= 2;
                    idx++;
                } else {
                    h -= 2;
                    count++;
                }

            }
            System.out.println(count);
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        int q = Integer.parseInt(br.readLine().trim());
        while (q-- > 0) {
            st = new StringTokenizer(br.readLine().trim());
            int h = Integer.parseInt(st.nextToken().trim());
            int n = Integer.parseInt(st.nextToken().trim());
            boolean[] plat = new boolean[h + 1];
            st = new StringTokenizer(br.readLine().trim());
            for (int i = 0; i < n; i++) {
                plat[Integer.parseInt(st.nextToken().trim())] = true;
            }
            int count = 0;
            while (h > 2) {
                if (!plat[h - 1]) {
                    h--;
                } else {
                    if (!plat[h - 2]) {
                        count++;
                    }
                    h -= 2;
                }
            }
            System.out.println(count);
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        int q = Integer.parseInt(br.readLine().trim());
        while (q-- > 0) {
            st = new StringTokenizer(br.readLine().trim());
            int h = Integer.parseInt(st.nextToken().trim());
            int n = Integer.parseInt(st.nextToken().trim());
            int[] plat = new int[n];
            st = new StringTokenizer(br.readLine().trim());
            for (int i = 0; i < n; i++) {
                plat[i] = Integer.parseInt(st.nextToken().trim());
            }
            int count = 0;
            int idx = 1;
            while (h > 2 && idx < n) {
                if (plat[idx] < h - 1) {
                    h = plat[idx] + 1;
                } else if (plat[idx] == h - 1) {
                    if (idx + 1 < n && plat[idx + 1] == h - 2) {
                        idx++;
                    } else {
                        count++;
                    }
                    h -= 2;
                    idx++;
                }
            }
            System.out.println(count);
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        int q = Integer.parseInt(br.readLine().trim());
        while (q-- > 0) {
            st = new StringTokenizer(br.readLine().trim());
            int h = Integer.parseInt(st.nextToken().trim());
            int n = Integer.parseInt(st.nextToken().trim());
            int[] plat = new int[n];
            st = new StringTokenizer(br.readLine().trim());
            for (int i = 0; i < n; i++) {
                plat[i] = Integer.parseInt(st.nextToken().trim());
            }
            int count = 0;
            int idx = 1;
            while (h > 2 && idx < n) {
                if (plat[idx] < h - 1) {
                    h--;
                } else if (plat[idx] == h - 1) {
                    if (idx+1<n && plat[idx + 1] == h - 2) {
                        idx++;
                    } else {
                        count++;
                    }
                    h -= 2;
                    idx++;
                }

            }
            System.out.println(count);
        }
    }
}


import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class C {
    public static void main(String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st;
        int q = Integer.parseInt(br.readLine().trim());
        while (q-- > 0) {
            st = new StringTokenizer(br.readLine().trim());
            int h = Integer.parseInt(st.nextToken().trim());
            int n = Integer.parseInt(st.nextToken().trim());
            int[] plat = new int[n];
            st = new StringTokenizer(br.readLine().trim());
            for (int i = 0; i < n; i++) {
                plat[i] = Integer.parseInt(st.nextToken().trim());
            }
            int count = 0;
            int idx = 1;
            while (h > 2) {
                if (idx < n && plat[idx] < h - 1) {
                    h--;
                } else if (idx + 1 < n && plat[idx] == h - 1) {
                    if (plat[idx + 1] != h - 2) {
                        count++;
                    } else {
                        idx++;
                    }
                    h -= 2;
                    idx++;
                } else {
                    break;
                }

            }
            System.out.println(count);
        }
    }
}


// Hash: bx3vq/ZPQ9b9T0SKHc2E9lrpNs4cTohCzhpw1AP4/jQ=

import java.security.*;
import java.util.*;
import java.nio.file.*;
import java.lang.annotation.*;
import java.util.stream.*;
import java.text.*;
import java.util.function.*;
import java.nio.charset.*;
import java.io.*;
import java.util.concurrent.*;
import java.lang.reflect.*;
import java.math.*;

// Solution can be found in Submission.testCase(). psvm method can be found in Main.main(String[] args)
// Please note that the code isn't obfuscated; only compressed

public class Solution {
    public static void main(String[] args) throws Exception {
        Main.main(args);
    }
}

class Main{public static void main(String[]args)throws Exception{new TaskC().runSubmission();}};

@ContestSubmission(ContestType.CODEFORCES)
@CacheVersion(0)
class TaskC extends AbstractSubmission {

	@Override
	public void testCase() {
		int t = sc.nextInt();
		outer: for (int it = 0; it < t; it++) {
			int h = sc.nextInt();
			int n = sc.nextInt();
			ArrayList<Integer> list = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				list.add(sc.nextInt());
			}
			Collections.reverse(list);

			int total = 0;

			while (true) {
				int x = list.isEmpty() ? 0 : list.get(list.size() - 1);
				list.remove(list.size() - 1);
				int u = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (u == x - 1) {
					if (!list.isEmpty()) list.remove(list.size() - 1);
				} else {
					list.add(Math.min(x - 1, u + 5));
				}
				u = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (x - u > 2) {
					total++;
					list.add(x - 2);
				}
				int nu = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (nu == 0) break;
			}

			out.println(total);
		}
	}

	@Override
	public void init() {
		// Nothing here! Good for initializing look-up tables

		// Note that there could be multiple Problem instances running on different threads. Writing static variables
		// here (or anywhere else) could lead to race conditions! Use static initialization instead
	}

	// Set to TRUE to override default (which may both be true or false). Setting to FALSE has no effect

	/* DISABLE-CODE-COMPRESSION: TRUE */
	/* GLOBAL-DISABLE-CODE-COMPRESSION: DEFAULT */
	/* JAVA-6-COMPATIBILITY-MODE: DEFAULT */
	/* KEEP-UNUSED-DEPENDENCIES: DEFAULT */

};

abstract class AbstractSubmission{public Scanner sc;public InputStream in;public PrintStream out;public PrintStream debug;public volatile double score=0;public volatile int testCaseCount=-1;public volatile int testCaseIndex;public volatile double progress=0;public void runSubmission(){runSubmission(false);}public void runSubmission(boolean debug){runSubmission(System.in,System.out,debug);}public void runSubmission(InputStream in,PrintStream out){runSubmission(in,out,false);}public void runSubmission(InputStream in,PrintStream out,boolean debug){runSubmission(in,out,debug?out:new VoidPrintStream());}public void runSubmission(InputStream in,OutputStream out,OutputStream debug){this.in=in;this.sc=new Scanner(this.in);this.out=new PrintStream(out);this.debug=debug instanceof VoidOutputStream?new VoidPrintStream():new PrintStream(debug);ContestType type=getType();testCaseCount=type.testCaseCount;init();if(testCaseCount<=0){testCaseCount=sc.nextInt();sc.nextLine();}testCaseIndex=0;for(testCaseIndex=1;testCaseIndex<=testCaseCount;testCaseIndex++){progress=0;this.out.printf(type.caseString,testCaseIndex,testCaseCount);testCase();}}public ContestType getType(){return getType(getClass());}public static ContestType getType(Class<?extends AbstractSubmission>clss){return getAnnotation(clss).value();}private static ContestSubmission getAnnotation(Class<?extends AbstractSubmission>clss){if(!clss.isAnnotationPresent(ContestSubmission.class)){throw new RuntimeException("ContestSubmission annotation not present on class "+clss.getCanonicalName()+"!");}return clss.getAnnotation(ContestSubmission.class);}private static String b64Hash(String s)throws NoSuchAlgorithmException{MessageDigest digest=MessageDigest.getInstance("SHA-256");byte[]encodedhash=Arrays.copyOf(digest.digest(s.getBytes(StandardCharsets.UTF_8)),3);return Base64.getEncoder().encodeToString(encodedhash);}public abstract void testCase();public abstract void init();};

abstract class Algorithm{private Object result;private boolean end;protected Object runCustomAlgorithm(Runnable runnable){end=false;result=null;runnable.run();return result;}protected void end(){end(null);}protected void end(Object result){if(shouldEnd())return;this.result=result;this.end=true;}protected boolean shouldEnd(){return end;}};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface CacheVersion{int value();};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface ContestSubmission{ContestType value();};

enum ContestType{PLAIN("",-1),ETH_JUDGE("",-1,null,false,false,6),GOOGLE("Case #%d: ",-1),GOOGLE_JAM("Case #%d: ",-1,"Solution.java",false,false,8),GOOGLE_JAM_INTERACTIVE("",-1,"Solution.java",false,false,8),FACEBOOK("Case #%d: ",-1),BLOOMBERG("",1,"Problem.java",false,false,8),SINGLE_TESTCASE("",1),OPTIMIZER("",1,null,false,false,8,true),HACKERRANK("",1,"Solution.java",false,false,8),CODEFORCES("",1,"Solution.java",false,false,8);public int testCaseCount;public String caseString;public String launcher;public boolean disableCompression;public boolean keepUnusedDependencies;public int javaVersion;public boolean isOptimizer;ContestType(String caseString,int testCaseCount,String launcher,boolean disableCompression,boolean keepUnusedDependencies,int javaVersion,boolean isOptimizer){this.caseString=caseString;this.testCaseCount=testCaseCount;this.launcher=launcher;this.disableCompression=disableCompression;this.javaVersion=javaVersion;this.keepUnusedDependencies=keepUnusedDependencies;this.isOptimizer=isOptimizer;}ContestType(String a1,int a2,String a3,boolean a4,boolean a5,int a6){this(a1,a2,a3,a4,a5,a6,false);}ContestType(String a1,int a2){this(a1,a2,null,false,false,8);}};

@Retention(RetentionPolicy.SOURCE)@Target(ElementType.METHOD)@interface O{String value();};

@Target(ElementType.FIELD)@Retention(RetentionPolicy.RUNTIME)@interface Optimize{long imin()default 0;long imax()default 100;double fmin()default 0;double fmax()default 1;};

class VoidOutputStream extends OutputStream{public void write(int b){return;}public void write(byte b[]){return;}public void write(byte b[],int off,int len){return;}};

class VoidPrintStream extends PrintStream{public VoidPrintStream(){super(new VoidOutputStream());}public void write(int b){return;}public void print(char[]buf){return;}public void print(String s){return;}public void print(Object obj){return;}public void println(char[]buf){return;}public void println(String s){return;}public void println(Object obj){return;}public PrintStream format(Locale l,String s,Object...objs){return this;}public PrintStream format(String s,Object...objs){return this;}};


// Hash: gIlM6+0WqAQQLHg/mJ9DxwIubLf0obB7ooIP4Xfbwlc=

import java.security.*;
import java.util.*;
import java.nio.file.*;
import java.lang.annotation.*;
import java.util.stream.*;
import java.text.*;
import java.util.function.*;
import java.nio.charset.*;
import java.io.*;
import java.util.concurrent.*;
import java.lang.reflect.*;
import java.math.*;

// Solution can be found in Submission.testCase(). psvm method can be found in Main.main(String[] args)
// Please note that the code isn't obfuscated; only compressed

public class Solution {
    public static void main(String[] args) throws Exception {
        Main.main(args);
    }
}

class Main{public static void main(String[]args)throws Exception{new TaskC().runSubmission();}};

@ContestSubmission(ContestType.CODEFORCES)
@CacheVersion(0)
class TaskC extends AbstractSubmission {

	@Override
	public void testCase() {
		int t = sc.nextInt();
		outer: for (int it = 0; it < t; it++) {
			int h = sc.nextInt();
			int n = sc.nextInt();
			ArrayList<Integer> list = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				list.add(sc.nextInt());
			}
			Collections.reverse(list);

			int total = 0;

			while (true) {
				int x = list.isEmpty() ? 0 : list.get(list.size() - 1);
				list.remove(list.size() - 1);
				int u = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (u == x - 1) {
					if (!list.isEmpty()) list.remove(list.size() - 1);
				} else {
					list.add(x - 1);
				}
				u = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (x - u > 2) {
					total++;
					list.add(x - 2);
				}
				int nu = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (nu == 0) break;

				if (list.size() >= 2 && list.get(list.size() - 1) - 3 > list.get(list.size() - 2)) {
					list.set(list.size() - 1, list.get(list.size() - 2) + 3);
				}
			}

			out.println(total);
		}
	}

	@Override
	public void init() {
		// Nothing here! Good for initializing look-up tables

		// Note that there could be multiple Problem instances running on different threads. Writing static variables
		// here (or anywhere else) could lead to race conditions! Use static initialization instead
	}

	// Set to TRUE to override default (which may both be true or false). Setting to FALSE has no effect

	/* DISABLE-CODE-COMPRESSION: TRUE */
	/* GLOBAL-DISABLE-CODE-COMPRESSION: DEFAULT */
	/* JAVA-6-COMPATIBILITY-MODE: DEFAULT */
	/* KEEP-UNUSED-DEPENDENCIES: DEFAULT */

};

abstract class AbstractSubmission{public Scanner sc;public InputStream in;public PrintStream out;public PrintStream debug;public volatile double score=0;public volatile int testCaseCount=-1;public volatile int testCaseIndex;public volatile double progress=0;public void runSubmission(){runSubmission(false);}public void runSubmission(boolean debug){runSubmission(System.in,System.out,debug);}public void runSubmission(InputStream in,PrintStream out){runSubmission(in,out,false);}public void runSubmission(InputStream in,PrintStream out,boolean debug){runSubmission(in,out,debug?out:new VoidPrintStream());}public void runSubmission(InputStream in,OutputStream out,OutputStream debug){this.in=in;this.sc=new Scanner(this.in);this.out=new PrintStream(out);this.debug=debug instanceof VoidOutputStream?new VoidPrintStream():new PrintStream(debug);ContestType type=getType();testCaseCount=type.testCaseCount;init();if(testCaseCount<=0){testCaseCount=sc.nextInt();sc.nextLine();}testCaseIndex=0;for(testCaseIndex=1;testCaseIndex<=testCaseCount;testCaseIndex++){progress=0;this.out.printf(type.caseString,testCaseIndex,testCaseCount);testCase();}}public ContestType getType(){return getType(getClass());}public static ContestType getType(Class<?extends AbstractSubmission>clss){return getAnnotation(clss).value();}private static ContestSubmission getAnnotation(Class<?extends AbstractSubmission>clss){if(!clss.isAnnotationPresent(ContestSubmission.class)){throw new RuntimeException("ContestSubmission annotation not present on class "+clss.getCanonicalName()+"!");}return clss.getAnnotation(ContestSubmission.class);}private static String b64Hash(String s)throws NoSuchAlgorithmException{MessageDigest digest=MessageDigest.getInstance("SHA-256");byte[]encodedhash=Arrays.copyOf(digest.digest(s.getBytes(StandardCharsets.UTF_8)),3);return Base64.getEncoder().encodeToString(encodedhash);}public abstract void testCase();public abstract void init();};

abstract class Algorithm{private Object result;private boolean end;protected Object runCustomAlgorithm(Runnable runnable){end=false;result=null;runnable.run();return result;}protected void end(){end(null);}protected void end(Object result){if(shouldEnd())return;this.result=result;this.end=true;}protected boolean shouldEnd(){return end;}};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface CacheVersion{int value();};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface ContestSubmission{ContestType value();};

enum ContestType{PLAIN("",-1),ETH_JUDGE("",-1,null,false,false,6),GOOGLE("Case #%d: ",-1),GOOGLE_JAM("Case #%d: ",-1,"Solution.java",false,false,8),GOOGLE_JAM_INTERACTIVE("",-1,"Solution.java",false,false,8),FACEBOOK("Case #%d: ",-1),BLOOMBERG("",1,"Problem.java",false,false,8),SINGLE_TESTCASE("",1),OPTIMIZER("",1,null,false,false,8,true),HACKERRANK("",1,"Solution.java",false,false,8),CODEFORCES("",1,"Solution.java",false,false,8);public int testCaseCount;public String caseString;public String launcher;public boolean disableCompression;public boolean keepUnusedDependencies;public int javaVersion;public boolean isOptimizer;ContestType(String caseString,int testCaseCount,String launcher,boolean disableCompression,boolean keepUnusedDependencies,int javaVersion,boolean isOptimizer){this.caseString=caseString;this.testCaseCount=testCaseCount;this.launcher=launcher;this.disableCompression=disableCompression;this.javaVersion=javaVersion;this.keepUnusedDependencies=keepUnusedDependencies;this.isOptimizer=isOptimizer;}ContestType(String a1,int a2,String a3,boolean a4,boolean a5,int a6){this(a1,a2,a3,a4,a5,a6,false);}ContestType(String a1,int a2){this(a1,a2,null,false,false,8);}};

@Retention(RetentionPolicy.SOURCE)@Target(ElementType.METHOD)@interface O{String value();};

@Target(ElementType.FIELD)@Retention(RetentionPolicy.RUNTIME)@interface Optimize{long imin()default 0;long imax()default 100;double fmin()default 0;double fmax()default 1;};

class VoidOutputStream extends OutputStream{public void write(int b){return;}public void write(byte b[]){return;}public void write(byte b[],int off,int len){return;}};

class VoidPrintStream extends PrintStream{public VoidPrintStream(){super(new VoidOutputStream());}public void write(int b){return;}public void print(char[]buf){return;}public void print(String s){return;}public void print(Object obj){return;}public void println(char[]buf){return;}public void println(String s){return;}public void println(Object obj){return;}public PrintStream format(Locale l,String s,Object...objs){return this;}public PrintStream format(String s,Object...objs){return this;}};


// Hash: Wck+TN2v95h/5VASwC+tIYh3vyJWYm5rrQUymtbOr4g=

import java.security.*;
import java.util.*;
import java.nio.file.*;
import java.lang.annotation.*;
import java.util.stream.*;
import java.text.*;
import java.util.function.*;
import java.nio.charset.*;
import java.io.*;
import java.util.concurrent.*;
import java.lang.reflect.*;
import java.math.*;

// Solution can be found in Submission.testCase(). psvm method can be found in Main.main(String[] args)
// Please note that the code isn't obfuscated; only compressed

public class Solution {
    public static void main(String[] args) throws Exception {
        Main.main(args);
    }
}

class Main{public static void main(String[]args)throws Exception{new TaskC().runSubmission();}};

@ContestSubmission(ContestType.CODEFORCES)
@CacheVersion(0)
class TaskC extends AbstractSubmission {

	@Override
	public void testCase() {
		int t = sc.nextInt();
		outer: for (int it = 0; it < t; it++) {
			int h = sc.nextInt();
			int n = sc.nextInt();
			ArrayList<Integer> list = new ArrayList<>();
			for (int i = 0; i < n; i++) {
				list.add(sc.nextInt());
			}
			Collections.reverse(list);

			int total = 0;

			while (true) {
				int x = list.isEmpty() ? 0 : list.get(list.size() - 1);
				list.remove(list.size() - 1);
				int u = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (u == x - 1) {
					if (!list.isEmpty()) list.remove(list.size() - 1);
				} else {
					list.add(Math.min(x - 1, u + 2));
				}
				u = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (x - u > 2) {
					total++;
					list.add(x - 2);
				}
				int nu = list.isEmpty() ? 0 : list.get(list.size() - 1);
				if (nu == 0) break;
			}

			out.println(total);
		}
	}

	@Override
	public void init() {
		// Nothing here! Good for initializing look-up tables

		// Note that there could be multiple Problem instances running on different threads. Writing static variables
		// here (or anywhere else) could lead to race conditions! Use static initialization instead
	}

	// Set to TRUE to override default (which may both be true or false). Setting to FALSE has no effect

	/* DISABLE-CODE-COMPRESSION: TRUE */
	/* GLOBAL-DISABLE-CODE-COMPRESSION: DEFAULT */
	/* JAVA-6-COMPATIBILITY-MODE: DEFAULT */
	/* KEEP-UNUSED-DEPENDENCIES: DEFAULT */

};

abstract class AbstractSubmission{public Scanner sc;public InputStream in;public PrintStream out;public PrintStream debug;public volatile double score=0;public volatile int testCaseCount=-1;public volatile int testCaseIndex;public volatile double progress=0;public void runSubmission(){runSubmission(false);}public void runSubmission(boolean debug){runSubmission(System.in,System.out,debug);}public void runSubmission(InputStream in,PrintStream out){runSubmission(in,out,false);}public void runSubmission(InputStream in,PrintStream out,boolean debug){runSubmission(in,out,debug?out:new VoidPrintStream());}public void runSubmission(InputStream in,OutputStream out,OutputStream debug){this.in=in;this.sc=new Scanner(this.in);this.out=new PrintStream(out);this.debug=debug instanceof VoidOutputStream?new VoidPrintStream():new PrintStream(debug);ContestType type=getType();testCaseCount=type.testCaseCount;init();if(testCaseCount<=0){testCaseCount=sc.nextInt();sc.nextLine();}testCaseIndex=0;for(testCaseIndex=1;testCaseIndex<=testCaseCount;testCaseIndex++){progress=0;this.out.printf(type.caseString,testCaseIndex,testCaseCount);testCase();}}public ContestType getType(){return getType(getClass());}public static ContestType getType(Class<?extends AbstractSubmission>clss){return getAnnotation(clss).value();}private static ContestSubmission getAnnotation(Class<?extends AbstractSubmission>clss){if(!clss.isAnnotationPresent(ContestSubmission.class)){throw new RuntimeException("ContestSubmission annotation not present on class "+clss.getCanonicalName()+"!");}return clss.getAnnotation(ContestSubmission.class);}private static String b64Hash(String s)throws NoSuchAlgorithmException{MessageDigest digest=MessageDigest.getInstance("SHA-256");byte[]encodedhash=Arrays.copyOf(digest.digest(s.getBytes(StandardCharsets.UTF_8)),3);return Base64.getEncoder().encodeToString(encodedhash);}public abstract void testCase();public abstract void init();};

abstract class Algorithm{private Object result;private boolean end;protected Object runCustomAlgorithm(Runnable runnable){end=false;result=null;runnable.run();return result;}protected void end(){end(null);}protected void end(Object result){if(shouldEnd())return;this.result=result;this.end=true;}protected boolean shouldEnd(){return end;}};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface CacheVersion{int value();};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface ContestSubmission{ContestType value();};

enum ContestType{PLAIN("",-1),ETH_JUDGE("",-1,null,false,false,6),GOOGLE("Case #%d: ",-1),GOOGLE_JAM("Case #%d: ",-1,"Solution.java",false,false,8),GOOGLE_JAM_INTERACTIVE("",-1,"Solution.java",false,false,8),FACEBOOK("Case #%d: ",-1),BLOOMBERG("",1,"Problem.java",false,false,8),SINGLE_TESTCASE("",1),OPTIMIZER("",1,null,false,false,8,true),HACKERRANK("",1,"Solution.java",false,false,8),CODEFORCES("",1,"Solution.java",false,false,8);public int testCaseCount;public String caseString;public String launcher;public boolean disableCompression;public boolean keepUnusedDependencies;public int javaVersion;public boolean isOptimizer;ContestType(String caseString,int testCaseCount,String launcher,boolean disableCompression,boolean keepUnusedDependencies,int javaVersion,boolean isOptimizer){this.caseString=caseString;this.testCaseCount=testCaseCount;this.launcher=launcher;this.disableCompression=disableCompression;this.javaVersion=javaVersion;this.keepUnusedDependencies=keepUnusedDependencies;this.isOptimizer=isOptimizer;}ContestType(String a1,int a2,String a3,boolean a4,boolean a5,int a6){this(a1,a2,a3,a4,a5,a6,false);}ContestType(String a1,int a2){this(a1,a2,null,false,false,8);}};

@Retention(RetentionPolicy.SOURCE)@Target(ElementType.METHOD)@interface O{String value();};

@Target(ElementType.FIELD)@Retention(RetentionPolicy.RUNTIME)@interface Optimize{long imin()default 0;long imax()default 100;double fmin()default 0;double fmax()default 1;};

class VoidOutputStream extends OutputStream{public void write(int b){return;}public void write(byte b[]){return;}public void write(byte b[],int off,int len){return;}};

class VoidPrintStream extends PrintStream{public VoidPrintStream(){super(new VoidOutputStream());}public void write(int b){return;}public void print(char[]buf){return;}public void print(String s){return;}public void print(Object obj){return;}public void println(char[]buf){return;}public void println(String s){return;}public void println(Object obj){return;}public PrintStream format(Locale l,String s,Object...objs){return this;}public PrintStream format(String s,Object...objs){return this;}};


// Hash: zq0JMbhdtUfAbTJHYYUJ41Wk9Ld1bOhzYDR4MF/o/Hw=

import java.security.*;
import java.util.*;
import java.nio.file.*;
import java.lang.annotation.*;
import java.util.stream.*;
import java.text.*;
import java.util.function.*;
import java.nio.charset.*;
import java.io.*;
import java.util.concurrent.*;
import java.lang.reflect.*;
import java.math.*;

// Solution can be found in Submission.testCase(). psvm method can be found in Main.main(String[] args)
// Please note that the code isn't obfuscated; only compressed

public class Solution {
    public static void main(String[] args) throws Exception {
        Main.main(args);
    }
}

class Main{public static void main(String[]args)throws Exception{new TaskC().runSubmission();}};

@ContestSubmission(ContestType.CODEFORCES)
@CacheVersion(0)
class TaskC extends AbstractSubmission {

	@Override
	public void testCase() {
		int t = sc.nextInt();
		outer: for (int it = 0; it < t; it++) {
			int h = sc.nextInt();
			int n = sc.nextInt();
			TreeSet<Integer> set = new TreeSet<>();
			for (int i = 0; i < n; i++) {
				set.add(sc.nextInt());
			}

			int total = 0;

			while (true) {
				int x = set.isEmpty() ? 0 : set.last();
				set.remove(x);
				if (set.contains(x - 1)) {
					set.remove(x - 1);
				} else {
					set.add(x - 1);
				}
				int u = set.isEmpty() ? 0 : set.last();
				if (x - u > 2) {
					total++;
					set.add(x - 2);
				}
				int nu = set.isEmpty() ? 0 : set.last();
				if (nu == 0) break;
			}

			out.println(total);
		}
	}

	@Override
	public void init() {
		// Nothing here! Good for initializing look-up tables

		// Note that there could be multiple Problem instances running on different threads. Writing static variables
		// here (or anywhere else) could lead to race conditions! Use static initialization instead
	}

	// Set to TRUE to override default (which may both be true or false). Setting to FALSE has no effect

	/* DISABLE-CODE-COMPRESSION: TRUE */
	/* GLOBAL-DISABLE-CODE-COMPRESSION: DEFAULT */
	/* JAVA-6-COMPATIBILITY-MODE: DEFAULT */
	/* KEEP-UNUSED-DEPENDENCIES: DEFAULT */

};

abstract class AbstractSubmission{public Scanner sc;public InputStream in;public PrintStream out;public PrintStream debug;public volatile double score=0;public volatile int testCaseCount=-1;public volatile int testCaseIndex;public volatile double progress=0;public void runSubmission(){runSubmission(false);}public void runSubmission(boolean debug){runSubmission(System.in,System.out,debug);}public void runSubmission(InputStream in,PrintStream out){runSubmission(in,out,false);}public void runSubmission(InputStream in,PrintStream out,boolean debug){runSubmission(in,out,debug?out:new VoidPrintStream());}public void runSubmission(InputStream in,OutputStream out,OutputStream debug){this.in=in;this.sc=new Scanner(this.in);this.out=new PrintStream(out);this.debug=debug instanceof VoidOutputStream?new VoidPrintStream():new PrintStream(debug);ContestType type=getType();testCaseCount=type.testCaseCount;init();if(testCaseCount<=0){testCaseCount=sc.nextInt();sc.nextLine();}testCaseIndex=0;for(testCaseIndex=1;testCaseIndex<=testCaseCount;testCaseIndex++){progress=0;this.out.printf(type.caseString,testCaseIndex,testCaseCount);testCase();}}public ContestType getType(){return getType(getClass());}public static ContestType getType(Class<?extends AbstractSubmission>clss){return getAnnotation(clss).value();}private static ContestSubmission getAnnotation(Class<?extends AbstractSubmission>clss){if(!clss.isAnnotationPresent(ContestSubmission.class)){throw new RuntimeException("ContestSubmission annotation not present on class "+clss.getCanonicalName()+"!");}return clss.getAnnotation(ContestSubmission.class);}private static String b64Hash(String s)throws NoSuchAlgorithmException{MessageDigest digest=MessageDigest.getInstance("SHA-256");byte[]encodedhash=Arrays.copyOf(digest.digest(s.getBytes(StandardCharsets.UTF_8)),3);return Base64.getEncoder().encodeToString(encodedhash);}public abstract void testCase();public abstract void init();};

abstract class Algorithm{private Object result;private boolean end;protected Object runCustomAlgorithm(Runnable runnable){end=false;result=null;runnable.run();return result;}protected void end(){end(null);}protected void end(Object result){if(shouldEnd())return;this.result=result;this.end=true;}protected boolean shouldEnd(){return end;}};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface CacheVersion{int value();};

@Retention(RetentionPolicy.RUNTIME)@Target(ElementType.TYPE)@interface ContestSubmission{ContestType value();};

enum ContestType{PLAIN("",-1),ETH_JUDGE("",-1,null,false,false,6),GOOGLE("Case #%d: ",-1),GOOGLE_JAM("Case #%d: ",-1,"Solution.java",false,false,8),GOOGLE_JAM_INTERACTIVE("",-1,"Solution.java",false,false,8),FACEBOOK("Case #%d: ",-1),BLOOMBERG("",1,"Problem.java",false,false,8),SINGLE_TESTCASE("",1),OPTIMIZER("",1,null,false,false,8,true),HACKERRANK("",1,"Solution.java",false,false,8),CODEFORCES("",1,"Solution.java",false,false,8);public int testCaseCount;public String caseString;public String launcher;public boolean disableCompression;public boolean keepUnusedDependencies;public int javaVersion;public boolean isOptimizer;ContestType(String caseString,int testCaseCount,String launcher,boolean disableCompression,boolean keepUnusedDependencies,int javaVersion,boolean isOptimizer){this.caseString=caseString;this.testCaseCount=testCaseCount;this.launcher=launcher;this.disableCompression=disableCompression;this.javaVersion=javaVersion;this.keepUnusedDependencies=keepUnusedDependencies;this.isOptimizer=isOptimizer;}ContestType(String a1,int a2,String a3,boolean a4,boolean a5,int a6){this(a1,a2,a3,a4,a5,a6,false);}ContestType(String a1,int a2){this(a1,a2,null,false,false,8);}};

@Retention(RetentionPolicy.SOURCE)@Target(ElementType.METHOD)@interface O{String value();};

@Target(ElementType.FIELD)@Retention(RetentionPolicy.RUNTIME)@interface Optimize{long imin()default 0;long imax()default 100;double fmin()default 0;double fmax()default 1;};

class Tree<T>implements Serializable{private TreeNode<T>root;Pair<Double,DoubleBinaryOperator>distanceFolder;public Tree(T rootValue){this(rootValue,null);}public Tree(T rootValue,Pair<Double,DoubleBinaryOperator>distanceFolder){this(distanceFolder);initRoot(new TreeNode(rootValue,this));}protected Tree(){this((Pair<Double,DoubleBinaryOperator>)null);}protected Tree(Pair<Double,DoubleBinaryOperator>distanceFolder){this.distanceFolder=distanceFolder==null?new Pair<>(0.0,Double::sum):distanceFolder;}protected void initRoot(TreeNode<T>node){if(root!=null)throw new IllegalStateException("Can't modify the root after it has already been initialized!");this.root=node;}public TreeNode<T>getRoot(){return root;}public String toString(){return root.toString();}};

class Pair<A,B>extends Tuple implements Map.Entry<A,B>{public A a;public B b;public Pair(A a,B b){this.a=a;this.b=b;}public A getLeft(){return a;}public B getRight(){return b;}public void setLeft(A a){this.a=a;}public void setRight(B b){this.b=b;}public<A1,B1>Pair<A1,B1>map(Function<A,A1>mapA,Function<B,B1>mapB){return new Pair<>(mapA.apply(this.a),mapB.apply(this.b));}public A getKey(){return a;}public A setKey(A a){A old=this.a;this.a=a;return old;}public B getValue(){return b;}public B setValue(B b){B old=this.b;this.b=b;return old;}public Object[]toArray(){return new Object[]{a,b};}public boolean equals(Object other){if(!(other instanceof Pair))return super.equals(other);Pair pair=(Pair)other;return Objects.equals(this.a,pair.a)&&Objects.equals(this.b,pair.b);}public int hashCode(){return 961+31*Objects.hashCode(a)+Objects.hashCode(b);}};

class TreeNode<T>implements Serializable{private T value;private int height;private double distance;private double distanceToParent;private List<TreeNode<T>>children;private TreeNode<T>parent;private Tree<T>tree;private Map<String,Object>attributeMap=null;public TreeNode(T value){this(value,null);}protected TreeNode(T value,Tree<T>tree){this.value=value;this.parent=null;this.tree=tree;this.children=new ArrayList<>();this.height=0;this.distance=tree.distanceFolder.a;}protected TreeNode(T value,TreeNode<T>parent,double distanceToParent){this.value=value;this.parent=parent;this.tree=parent.tree;this.children=new ArrayList<>();this.height=parent.getHeight()+1;this.distanceToParent=distanceToParent;this.distance=tree.distanceFolder.b.applyAsDouble(parent.getDistance(),distanceToParent);}public T getValue(){return value;}public void setValue(T value){this.value=value;}public int getHeight(){return height;}public double getDistance(){return distance;}public double getDistanceToParent(){if(!hasParent())throw new NoSuchElementException("Node has no parent!");return this.distanceToParent;}public List<TreeNode<T>>getChildren(){return Collections.unmodifiableList(children);}public int getChildCount(){return children.size();}public TreeNode<T>addChild(T value){return addChild(value,1);}public TreeNode<T>addChild(T value,double distance){return createUnattached(value,distance).attach();}public TreeNode<T>.Unattached createUnattached(T value,double distance){return new Unattached(value,distance);}class Unattached extends TreeNode<T>{private boolean isAttached=false;private Unattached(T value,double distance){super(value,TreeNode.this,distance);}public TreeNode<T>attach(){if(isAttached())throw new NoSuchElementException("Node has already been attached!");TreeNode.this.children.add(this);isAttached=true;return this;}public boolean isAttached(){return isAttached;}}public TreeNode<T>getParent(){return parent;}public List<TreeNode<T>>getParentChain(){List<TreeNode<T>>res=new ArrayList<>();TreeNode<T>node=this;while((node=node.getParent())!=null){res.add(node);}Collections.reverse(res);return res;}public boolean hasParent(){return getParent()!=null;}public Tree<T>getTree(){return tree;}public boolean isAttached(){return true;}public Map<String,Object>getAttributeMap(){if(attributeMap==null)attributeMap=new HashMap<>(3);return attributeMap;}public<U>U inheritAttribute(String attrName,U firstValue,BiFunction<U,TreeNode<T>,U>fold){return(U)getAttributeMap().computeIfAbsent(attrName,k->{U val=firstValue;for(TreeNode<T>node:getParentChain()){Map<String,Object>map=node.getAttributeMap();if(map.containsKey(attrName))return map.get(attrName);val=fold.apply(val,node);}return firstValue;});}public String toString(){return value.toString()+(children.isEmpty()?"":children.toString());}};

abstract class Tuple extends Structure{public abstract Object[]toArray();public boolean equals(Object obj){if(obj==null)return false;if(!(obj instanceof Tuple))return false;return Arrays.equals(this.toArray(),((Tuple)obj).toArray());}public int hashCode(){return Arrays.hashCode(this.toArray());}public String toString(){Object[]els=toArray();String[]elements=new String[els.length];for(int i=0;i<els.length;i++){elements[i]=""+els[i];}return "("+String.join(", ",elements)+")";}};

abstract class Structure implements Serializable,Cloneable{public Structure clone(){try{Structure struct=(Structure)super.clone();for(Field field:this.getClass().getDeclaredFields()){field.setAccessible(true);if(Modifier.isTransient(field.getModifiers())){continue;}field.set(struct,field.get(this));}return struct;}catch(CloneNotSupportedException e){throw new AssertionError("Cloning a structure should always be supported - please report this bug",e);}catch(IllegalAccessException e){throw new RuntimeException("Can't access my own elements!",e);}}private NavigableMap<String,Object>getFields(){try{NavigableMap<String,Object>result=new TreeMap<String,Object>();for(Field field:this.getClass().getFields()){if(Modifier.isTransient(field.getModifiers())){continue;}result.put(field.getName(),field.get(this));}return result;}catch(IllegalAccessException e){throw new RuntimeException("Can't access my own elements!",e);}}public boolean equals(Object obj){if(obj==null)return false;if(getClass()!=obj.getClass())return false;return getFields().equals(((Structure)obj).getFields());}public int hashCode(){return getFields().hashCode();}public String toString(){return getFields().toString();}};

class VoidOutputStream extends OutputStream{public void write(int b){return;}public void write(byte b[]){return;}public void write(byte b[],int off,int len){return;}};

class VoidPrintStream extends PrintStream{public VoidPrintStream(){super(new VoidOutputStream());}public void write(int b){return;}public void print(char[]buf){return;}public void print(String s){return;}public void print(Object obj){return;}public void println(char[]buf){return;}public void println(String s){return;}public void println(Object obj){return;}public PrintStream format(Locale l,String s,Object...objs){return this;}public PrintStream format(String s,Object...objs){return this;}};