#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t != 0) {
    int h, n, i;
    cin >> h >> n;
    int a[n];
    for (i = 1; i <= n; i++) {
      cin >> a[i];
    }
    a[n + 1] = 0;
    int count = 0;
    for (i = 2; i <= n; i++) {
      if (h - a[i] > 1) {
        h = a[i] + 1;
        i--;
      } else if (h - a[i + 1] > 2) {
        count++;
        h = h - 1;
      } else {
        i++;
        h = a[i];
      }
    }
    cout << count << endl;
    t--;
  }
  return 0;
}
