#include <bits/stdc++.h>
using namespace std;
int h, n, pre, cur, ans;
bool ok;
void solve() {
  cin >> h >> n >> pre;
  ans = 0;
  ok = false;
  while (--n) {
    cin >> cur;
    if (!ok)
      ok = true;
    else if (cur != pre - 1)
      ++ans;
    else
      ok = false;
    pre = cur;
  }
  if (ok && pre != 1) ++ans;
  cout << ans << '\n';
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) solve();
  return 0;
}
