#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
const long long int mod1 = 998244353;
bool isprime[100000];
vector<long long int> prime;
void sieve() {
  long long int i, j;
  for (i = 2; i < 1e5; i++) isprime[i] = true;
  for (i = 2; i < 1e5; i++) {
    if (isprime[i]) {
      prime.push_back(i);
      for (j = i * i; j < 1e5; j += i) isprime[i] = false;
    }
  }
}
long long int power(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
long long int powermod(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = ((res % mod) * (a % mod)) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res % mod;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int T;
  cin >> T;
  while (T--) {
    long long int h, n;
    cin >> h >> n;
    long long int a[n + 1], i;
    for (i = 0; i < n; i++) cin >> a[i];
    a[n] = 0;
    if ((n == 1) || (h <= 2)) {
      cout << 0 << endl;
      continue;
    }
    long long int cnt = 0;
    for (i = 0; i < n; i++) {
      if (a[i] == h) {
        if ((a[i] == a[i + 1] + 1) && (a[i] == a[i + 2] + 2)) {
          h = a[i + 2];
          i++;
        } else if (a[i] == a[i + 1] + 1) {
          cnt++;
          h = a[i + 2] + 1;
          i++;
        } else {
          h = a[i + 1] + 1;
        }
      } else if (h == a[i] + 1) {
        if (a[i + 1] + 1 == a[i])
          h = a[i + 1];
        else {
          cnt++;
          h = a[i + 1] + 1;
        }
      }
      if (h <= 2) break;
    }
    cout << cnt << endl;
  }
  return 0;
}
