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