#include <bits/stdc++.h>
using namespace std;
template <class K>
inline bool cmax(K& a, const K& b) {
  return (a < b) ? a = b, 1 : 0;
}
template <class K>
inline bool cmin(K& a, const K& b) {
  return (a > b) ? a = b, 1 : 0;
}
inline int read() {
  register int s = 0;
  register char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) s = (s << 1) + (s << 3) + c - '0', c = getchar();
  return s;
}
int T, n, h, ans, a[200007];
int main() {
  register int i, j;
  T = read();
  while (T--) {
    h = read(), n = read(), a[0] = h + 1;
    for (i = 1; i <= n; i++) a[i] = read();
    i = ans = 0;
    while (i <= n) {
      j = i + 1;
      while (j <= n && a[j] == a[j - 1] - 1) ++j;
      if (j > n)
        ans += (i - j) & 1 & (a[n] > 1);
      else
        ans += (i - j) & 1;
      i = j;
    }
    printf("%d\n", ans);
  }
  return 0;
}
