#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, h;
    cin >> h >> n;
    vector<int> v;
    for (int i = 0; i < n; i++) {
      int x;
      cin >> x;
      v.push_back(x);
    }
    vector<int> chunks_size;
    v.push_back(0);
    int tmp = 1;
    for (int i = 1; i < n; i++) {
      if (v[i + 1] == v[i] - 1) {
        tmp++;
      } else {
        if (v[i] != 1) {
          chunks_size.push_back(tmp);
          tmp = 1;
        }
      }
    }
    int ans = 0;
    int s = chunks_size.size();
    for (int i = 0; i < s; i++) {
      if (chunks_size[i] % 2 == 1) {
        ans++;
      }
    }
    cout << ans << endl;
  }
  return 0;
}
