#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int MAX = 100005;
long long modexp(long long x, long long n) {
  if (n == 0) return 1LL;
  if (n % 2 == 0) {
    long long y = modexp(x, n / 2) % mod;
    return (y * y) % mod;
  }
  return (x * modexp(x, n - 1) % mod) % mod;
}
long long powr(long long x, long long n) {
  long long ans = 1;
  for (int i = 1; i <= n; i++) ans = ans * x;
  return ans;
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int h, n;
    scanf("%d", &h), scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    int ans = 0;
    int idx = 0;
    int start = a[0];
    while (idx < n) {
      int cnt = 1;
      if (start <= 2) break;
      while (idx + 1 < n && (start - a[idx + 1]) == 1) {
        cnt++;
        start = a[idx + 1];
        idx++;
      }
      if (cnt % 2 == 0) {
        if (start - 1 != 0) ans++;
      }
      if (idx + 1 < n) {
        start = a[idx + 1] + 1;
      } else
        break;
    }
    printf("%d\n", ans);
  }
  return 0;
}
