#include <bits/stdc++.h>
using namespace std;
bool cmp(long long a, long long b) { return a > b; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int T;
  cin >> T;
  while (T--) {
    long long h, n;
    cin >> h >> n;
    vector<long long> a(n, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    long long mg = 0;
    while (a.size() != 0) {
      long long i = a.size() - 1;
      if (a[i] <= 2) break;
      if (a[i - 1] + 1 == a[i]) {
        if (a[i - 2] + 2 != a[i]) {
          int t = a[i] - 2;
          a.pop_back();
          a.pop_back();
          a.push_back(t);
          mg++;
        } else {
          a.pop_back();
          a.pop_back();
        }
      } else {
        a.pop_back();
        if (!a.empty()) a.push_back(a[i - 1] + 1);
      }
    }
    cout << endl << mg << endl;
  }
  return 0;
}
