#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int INF = 0x3F3F3F3F;
const int64_t LINF = 4611686018427387903;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 9;
void solve() {
  int h, n, ans = 0;
  cin >> h >> n;
  vector<int> arr(n);
  set<int> has;
  for (int &a : arr) cin >> a, has.insert(a);
  arr.push_back(0);
  sort(arr.begin(), arr.end(), greater<int>());
  for (int i = 1; i < n + 1; i++) {
    int now = arr[i], prev = arr[i - 1];
    if (now == prev - 1) {
      if (has.count(prev)) {
        has.erase(prev);
        has.erase(now);
      }
    } else {
      if (!has.count(prev)) {
        ans++;
      }
      has.erase(prev);
      has.erase(now);
    }
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
