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