#include <bits/stdc++.h>
using namespace std;
long long int p[200005];
int main() {
  long long int q, h, n;
  cin >> q;
  while (q--) {
    cin >> h >> n;
    for (int i = 1; i <= n; i++) cin >> p[i];
    int ans = 0;
    p[n + 1] = 0;
    for (int i = 2; i <= n; i++) {
      if (p[i] == p[i + 1] + 1)
        i++;
      else
        ans++;
    }
    cout << ans << endl;
  }
}
