#include <bits/stdc++.h>
using namespace std;
long long p[1000007];
long long ans[1000007];
void shihab(long long t) {
  long long h, n;
  cin >> h >> n;
  long long c = 0;
  for (long long i = 1; i <= n; i++) cin >> p[i];
  for (long long i = 1; i < n; i++) {
    p[i] = p[i + 1] + 1;
    if (p[i + 2] == p[i] - 2) {
      i++;
      continue;
    }
    if (p[i] < 3) continue;
    c++;
  }
  ans[t] = c;
  cout << c << "\n";
  for (long long i = 1; i <= n; i++) p[i] = 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  long long t;
  cin >> t;
  for (long long i = 1; i <= t; i++) shihab(i);
}
