#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    vector<long long> v(k);
    for (int i = 0; i < k; i++) cin >> v[i];
    long long magic_crystal = 0, curr_pos = v[0];
    for (long long i = 1; i < k and curr_pos > 2;) {
      if (v[i] == 1)
        break;
      else if (i + 1 < k and v[i] - v[i + 1] == 1)
        curr_pos = v[i + 1], i += 2;
      else
        magic_crystal++, curr_pos = v[i] - 1, i++;
    }
    cout << magic_crystal << endl;
  }
  return 0;
}
