#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000000 + 7;
const long long int N = 1000000 + 6;
void inp(long long int *arr, long long int n) {
  for (int i = 0; i < n; i++) cin >> arr[i];
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int q;
  cin >> q;
  while (q--) {
    long long int h, n;
    cin >> h >> n;
    vector<long long int> v;
    for (int i = 0; i < n; i++) {
      long long int x;
      cin >> x;
      v.push_back(x);
    }
    int ans = 0;
    int streak = 1;
    if (n == 1) {
      cout << "0\n";
      continue;
    }
    for (int i = 1; i < n - 1; i++) {
      if (v[i] - v[i + 1] == 1)
        streak++;
      else {
        if (streak % 2 != 0) ans++;
        streak = 1;
      }
    }
    if (streak == 1 and v[n - 1] != 1)
      ans++;
    else if (v[n - 1] != 1 and streak % 2 != 0)
      ans++;
    cout << ans << '\n';
  }
}
