#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tt;
  cin >> tt;
  while (tt--) {
    int h, n;
    cin >> h >> n;
    int p[n];
    for (auto &e : p) cin >> e;
    int ans = 0;
    int i = 0, j = 0;
    while (i < n) {
      j = i + 1;
      while (j < n && p[j - 1] == p[j] + 1) j++;
      if (p[j - 1] > 1) {
        if ((i == 0 && (j - i) % 2 == 0) || (i != 0 && (j - i) % 2 == 1)) ans++;
      }
      i = j;
    }
    cout << ans << '\n';
  }
}
