#include <bits/stdc++.h>
using namespace std;
long long h, n;
vector<long long> dp, arr;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long q;
  cin >> q;
  while (q--) {
    cin >> h >> n;
    arr.resize(n);
    for (long long i = 0; i < n; i++) cin >> arr[i];
    dp.resize(n, 0);
    if (n > 1) dp[1]++;
    for (long long i = 2; i < n; i++) {
      if (arr[i - 1] >= arr[i] + 2)
        dp[i] = dp[i - 1] + 1;
      else
        dp[i] = min(dp[i - 1] + 1, dp[i - 2]);
    }
    if (arr[n - 1] == 1 && n >= 2)
      cout << min(dp[n - 1], dp[n - 2]) << "\n";
    else
      cout << dp[n - 1] << "\n";
    dp.clear();
    arr.clear();
  }
}
