#include <bits/stdc++.h>
using namespace std;
vector<int> GetLengths(const vector<int> &heights) {
  vector<int> lengths;
  for (size_t i = 0; i < heights.size(); i += 1) {
    if (i == 0 || heights[i] < heights[i - 1] - 1) {
      lengths.push_back(1);
    } else {
      lengths.back() += 1;
    }
  }
  return lengths;
}
int GetCost(const vector<int> &heights) {
  auto lengths = GetLengths(heights);
  auto extra = 0;
  auto cost = 0;
  for (const auto &l : lengths) {
    auto actual = l + extra;
    cost += (1 - (actual % 2));
    extra = 1;
  }
  return cost;
}
int Solve(vector<int> &heights) {
  auto cost_one = GetCost(heights);
  heights.push_back(0);
  auto cost_two = GetCost(heights);
  return min(cost_one, cost_two);
}
int main() {
  int tests;
  cin >> tests;
  for (int i = 0; i < tests; i += 1) {
    int height, n;
    cin >> height >> n;
    vector<int> heights(n);
    for (auto &h : heights) {
      cin >> h;
    }
    auto res = Solve(heights);
    cout << res << "\n";
  }
  return 0;
}
