#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int h, n;
    cin >> h >> n;
    vector<int> p(n);
    for (int& pi : p) cin >> pi;
    p.push_back(0);
    int r = 0, i = 1;
    while (i < n) {
      if (p[i] - 1 == p[i + 1])
        i += 2;
      else {
        ++i;
        ++r;
      }
    }
    cout << r << "\n";
  }
  return 0;
}
