#include <bits/stdc++.h>
using namespace std;
long long n, h;
long long a[200005];
void Input() {
  scanf("%lld%lld", &h, &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
}
void Calculation() {
  long long res = 0;
  a[n + 1] = -2;
  for (int i = 2; i <= n; i++) {
    if (a[i] == 1) continue;
    if (a[i] - 1 != a[i + 1])
      res++;
    else
      i++;
  }
  printf("%lld\n", res);
}
void Solve() {
  Input();
  Calculation();
}
int main() {
  long long q;
  scanf("%lld", &q);
  while (q--) Solve();
  return 0;
}
