#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T, p;
  cin >> T;
  for (p = 1; p <= T; p++) {
    long long int N, M;
    cin >> N >> M;
    long long int a, b, c, i, j, k, A[M], ans = 0;
    for (i = 0; i < M; i++) {
      cin >> A[i];
    }
    a = 1;
    bool x = true;
    for (i = 1; i < M; i++) {
      if (A[i] + 1 == A[i - 1]) {
        a++;
        continue;
      }
      if (x) {
        if (a % 2 != 1) ans++;
        x = false;
      } else {
        if (a % 2 != 0) ans++;
      }
      a = 1;
    }
    if (x) {
      if (A[M - 1] != 1) {
        if (a % 2 != 1) ans++;
      }
    } else {
      if (A[M - 1] != 1) {
        if (a % 2 != 0) ans++;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
