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