#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int h, n;
    cin >> h >> n;
    vector<int> V;
    for (int i = 0; i < n; i++) {
      int p;
      cin >> p;
      V.push_back(p);
    }
    sort(V.begin(), V.end());
    vector<int> Vp;
    if (V[0] == 1)
      Vp.push_back(1);
    else
      Vp.push_back(2);
    for (int i = 1; i < n; i++) {
      if (V[i] - V[i - 1] == 1)
        Vp.push_back(Vp.back() + 1);
      else
        Vp.push_back(Vp.back() + 2);
    }
    n = Vp.size();
    h = Vp.back();
    vector<bool> P(h + 1, false);
    for (int i = 0; i < n; i++) P[Vp[i]] = 1;
    vector<int> dp(h + 1, 1e9);
    dp[h] = 0;
    if (P[h - 1])
      dp[h - 1] = 1;
    else
      dp[h - 1] = 0;
    for (int i = h - 2; i >= 1; i--) {
      dp[i] = min(dp[i], int(!P[i + 1]) + int(!P[i]) + dp[i + 2]);
      dp[i] = min(dp[i], int(P[i]) + dp[i + 1]);
    }
    int ans = dp[1];
    if (h >= 2) ans = min(ans, dp[2]);
    cout << ans << endl;
  }
}
