#include <bits/stdc++.h>
using namespace std;
void solve() {
  int h, n;
  cin >> h >> n;
  vector<long long> v(n);
  for (long i = 0; i < n; i++) cin >> v[i];
  int ans = 0;
  v.push_back(0);
  for (int i = 1; i < n; i++) {
    if (v[i] - v[i + 1] != 1)
      ans++;
    else
      i++;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
