#include <bits/stdc++.h>
using namespace std;
const long long INF = 0x3f3f3f3f;
const int eps = 1e-8;
const long long mod = 1e9 + 7;
const long long maxn = 2e5 + 10;
const unsigned long long modd = 212370440130137957ll;
const long long Mod = 998244353;
int lowbit(int x) { return x & -x; }
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long quick_power(long long a, long long b, long long c) {
  long long ans = 1;
  a = a % c;
  while (b) {
    if (b & 1) ans = (ans * a) % c;
    b = b >> 1;
    a = (a * a) % c;
  }
  return ans;
}
bool isprime(long long x) {
  int flag = 1;
  for (long long i = 2; i * i <= x; i++) {
    if (x % i == 0) {
      flag = 0;
      break;
    }
  }
  if (flag)
    return 1;
  else
    return 0;
}
int t;
int a[maxn];
map<int, int> mapp;
int h, n;
int main() {
  cin >> t;
  while (t--) {
    memset(a, 0, sizeof(a));
    cin >> h >> n;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
    }
    a[n] == 0;
    int ans = 0;
    for (int i = 1; i < n; i++) {
      if (a[i + 1] + 1 == a[i]) {
        i++;
      } else {
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
