#include <bits/stdc++.h>
using namespace std;
int p[200005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int q;
  cin >> q;
  while (q--) {
    int h, n;
    cin >> h >> n;
    for (int i = 0; i < n; ++i) {
      cin >> p[i];
    }
    if (n == 1) {
      cout << 0 << "\n";
      continue;
    }
    int cp = p[0];
    int ans = 0;
    int np = 1;
    while (np < n) {
      if (cp != p[np] + 1) {
        cp = p[np] + 1;
      }
      if (np != n - 1 and (cp == p[np + 1] + 2)) {
        cp = p[np + 1];
        np = np + 2;
        continue;
      } else {
        if (np == n - 1 and cp <= 2) {
          break;
        }
        ++ans;
        cp = p[np] - 1;
        np = np + 1;
        ;
        continue;
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
