#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long bp(long long x, long long y) {
  long long ans = 1;
  x %= mod;
  while (y) {
    if (y & 1) ans = ans * x % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long mod_inverse(long long x) { return bp(x, mod - 2); }
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
long long max(long long a, long long b) {
  if (a < b) swap(a, b);
  return a;
}
long long min(long long a, long long b) {
  if (a > b) swap(a, b);
  return a;
}
long long countSetBits(long long n) {
  long long count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
void solve() {
  long long t;
  cin >> t;
  while (t--) {
    long long h, n;
    cin >> h >> n;
    long long a[n];
    for (long long i = 0; i < n; i++) cin >> a[i];
    long long dp[n];
    if (n == 1) {
      cout << "0" << '\n';
      continue;
    }
    dp[0] = 0;
    for (long long i = 1; i < n; i++) {
      if (a[i] + 1 == a[i - 1]) {
        dp[i] = dp[i - 1] + 1;
        if (i - 2 >= 0) dp[i] = min(dp[i], dp[i - 2]);
      } else
        dp[i] = dp[i - 1] + 1;
    }
    if (a[n - 1] == 1)
      cout << min(dp[n - 2], dp[n - 1]) << '\n';
    else
      cout << dp[n - 1] << '\n';
  }
}
signed main() { solve(); }
