#include <bits/stdc++.h>
int h, n, a[200005], vis[200005];
void solve() {
  scanf("%d%d", &h, &n);
  a[0] = 0;
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  int size = 0, ans = 0;
  vis[n + 1] = vis[n + 2] = 1;
  a[n + 1] = 0;
  for (int i = n; i >= 0; i--) {
    if (a[i] == a[i + 1] + 1)
      vis[i] = vis[i + 1];
    else
      vis[i] = vis[i + 1] + 1;
  }
  int i = 1;
  while (1) {
    if (vis[i] == vis[n + 1]) break;
    if (vis[i] != vis[i + 1]) {
      vis[i] = vis[i + 1];
    } else if (vis[i + 2] != vis[i]) {
      ans++;
      i += 1;
      vis[i] = vis[i + 1];
    } else
      i += 2;
  }
  printf("%d\n", ans);
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) solve();
  return 0;
}
