#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 5;
long long p[N];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long q;
  cin >> q;
  while (q--) {
    long long h, n, cnt = 0;
    cin >> h >> n;
    for (long long i = 0; i < n; i++) {
      cin >> p[i];
    }
    p[n] = 0;
    long long i = 0;
    while (i < n - 1) {
      if (p[i + 1] - p[i + 2] != 1) {
        cnt++;
        i++;
      } else {
        i += 2;
      }
    }
    cout << cnt << endl;
  }
}
