#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e6 + 1;
const int INF = 2e9 + 1;
const int MOD = (1e9 + 7);
void bye(string s = "") {
  cout << s << '\n';
  exit(0);
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q;
  cin >> q;
  while (q--) {
    int h, n;
    cin >> h >> n;
    vector<int> arr(n + 1);
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
    }
    int ans = 0;
    for (int i = 1; i < n; i++) {
      if (arr[i] - arr[i + 1] >= 2)
        ans++;
      else
        i++;
    }
    cout << ans << '\n';
  }
  bye();
}
