#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q;
  cin >> q;
  while (q--) {
    int n, h;
    cin >> h >> n;
    int a[n];
    for (int i = 0; i < n; i++) cin >> a[i];
    int ans = 0;
    int prev = h;
    for (int i = 1; i < n; i++) {
      if (a[i] == prev) continue;
      if (a[i] != prev - 1) {
        prev = a[i] + 1;
      }
      prev = a[i] - 1;
      if (i + 1 < n) {
        if (a[i + 1] != a[i] - 1) {
          ans++;
        }
      } else if (prev > 0) {
        ans++;
      }
    }
    cout << ans << endl;
  }
}
