#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
const long long mod = 1e9 + 7;
int32_t main() {
  long long q;
  cin >> q;
  while (q--) {
    long long h, n;
    cin >> h >> n;
    long long p[n];
    set<long long> s;
    for (long long i = 0; i < n; i++) {
      cin >> p[i];
      s.insert(p[i]);
    }
    s.insert(0);
    long long curr = p[0];
    long long gem = 0;
    for (long long i = 1; i < n; i++) {
      if (curr > p[i])
        curr = p[i] + 1;
      else {
        continue;
      }
      if (p[i] == curr - 1 && !s.count(curr - 2)) {
        curr = curr - 2;
        gem++;
      } else if (s.count(curr - 2) && p[i] == curr - 1)
        curr = curr - 2;
    }
    cout << gem << '\n';
  }
  return 0;
}
