#include <bits/stdc++.h>
using namespace std;
long long A[300009];
int main() {
  long long N, M, i, j, k, H, Q, cnt = 0, now;
  cin >> Q;
  while (Q--) {
    cnt = 0;
    cin >> H >> N;
    now = H;
    for (i = 0; i < N; i++) {
      cin >> A[i];
    }
    A[N] = 0;
    N++;
    now = H;
    for (i = 1; i < N; i++) {
      if (i >= N - 1) break;
      now = A[i] + 1;
      if (now <= 2) break;
      if (A[i + 1] == A[i] - 1) {
        i += 1;
      } else {
        cnt++;
      }
    }
    cout << cnt << endl;
  }
}
