#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
  return x;
}
const int maxn = 2e5 + 10;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double eps = 1e-7;
int h, n;
int p[maxn];
void solve() {
  h = read(), n = read();
  for (int i = 1; i <= n; ++i) p[i] = read();
  int ans = 0;
  for (int i = 2; i <= n; ++i) {
    int cur = 1;
    while (i + 1 <= n && p[i] == p[i + 1] + 1) cur++, i++;
    if (cur & 1) ans++;
    if (i == n && p[n] == 1 && (cur & 1)) ans--;
  }
  printf("%d\n", ans);
}
int main() {
  int q = read();
  while (q--) solve();
}
