#include <bits/stdc++.h>
using namespace std;
int main() {
  int q;
  cin >> q;
  while (q--) {
    int n, h;
    cin >> h >> n;
    int a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    int cnt = 1;
    vector<int> v;
    for (int i = 1; i < n; ++i) {
      if (a[i] == a[i - 1] - 1) {
        ++cnt;
      } else {
        v.push_back(cnt);
        cnt = 1;
      }
    }
    v.push_back(cnt);
    int sm = 0;
    if (v.size() == 1) {
      if (a[n - 1] < 2)
        sm = 0;
      else {
        if (v[0] % 2 == 0)
          sm = 1;
        else
          sm = 0;
      }
    } else {
      for (int i = 0; i < v.size(); ++i) {
        if (i == 0) {
          if (v[i] % 2 == 0) ++sm;
        } else if (i == v.size() - 1) {
          ++v[i];
          if (a[n - 1] >= 2 && v[i] % 2 == 0) ++sm;
        } else {
          ++v[i];
          if (v[i] % 2 == 0) ++sm;
        }
      }
    }
    cout << sm << endl;
  }
}
