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