#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int h, n;
    cin >> h >> n;
    int v[200005];
    for (int i = 0; i < n; i++) cin >> v[i];
    v[n] = 0;
    v[n + 1] = 0;
    v[n + 2] = 0;
    int ans = 0;
    for (int i = 0; i < n; i++) {
      if (v[i] == 1) continue;
      if (v[i] == v[i + 1] + 1) {
        if (v[i] == v[i + 2] + 2)
          i++;
        else {
          ans++;
          v[i + 1] = v[i + 2] + 1;
        }
      } else {
        v[i] = v[i + 1] + 1;
        i--;
      }
    }
    cout << ans << '\n';
  }
  return 0;
}
