#include <bits/stdc++.h>
using namespace std;
ifstream in("input.txt");
ofstream out("output.txt");
vector<int> v[500001];
vector<vector<int>> v2(101), g2(101);
vector<pair<int, int>> vi[100001];
set<int> st;
int ph[2000001] = {0};
long long ncr[5001][5001];
void coeff() {
  ncr[0][0] = 1;
  for (int i = 1; i < 1001; i++) {
    ncr[i][0] = 1;
    for (int j = 1; j <= i; j++) {
      ncr[i][j] = (ncr[i - 1][j - 1] + ncr[i - 1][j]) % 998244353;
    }
  }
}
long long fast_exp(long long base, long long exp1) {
  long long res = 1;
  while (exp1 > 0) {
    if (exp1 & 1) res = (res * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp1 /= 2;
  }
  return res % 1000000007;
}
long long pr[1000001] = {0};
void isprime() {
  pr[0] = 1;
  pr[1] = 1;
  for (long long a = 2; a * a <= 1000001; a++) {
    if (!pr[a]) {
      for (long long b = a * a; b < 1000001; b += a) {
        pr[b] = 1;
      }
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 0;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a[k + 1];
    for (long long i = 0; i < k; i++) cin >> a[i];
    a[k] = 0;
    long long s = 0;
    for (int i = 1; i < k; i++) {
      if (a[i] - a[i + 1] == 1)
        i++;
      else
        s++;
    }
    cout << s << endl;
  }
  return 0;
}
