#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
long long int q, n, h, p[200005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, j, prev;
  cin >> q;
  while (q--) {
    cin >> h >> n;
    for (i = 1; i <= n; i++) cin >> p[i];
    prev = p[1];
    long long int ans = 0;
    for (i = 2; i < n; i++) {
      if (prev <= p[i]) continue;
      prev = p[i] + 1;
      if (p[i + 1] != p[i] - 1 && p[i] > 1) ans++;
      prev = p[i] - 1;
    }
    if (prev > p[n] && p[n] > 1) {
      prev = p[n] + 1;
      ans++;
    }
    cout << ans << '\n';
  }
  return 0;
}
