#include <bits/stdc++.h>
using namespace std;
const int mx = 1e6;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  while (t--) {
    long long n, h;
    cin >> h >> n;
    long long arr[n];
    for (int i = 0; i < n; i++) cin >> arr[i];
    long long ans = 0, cp = h;
    for (int i = 1; i < n; i++) {
      if (cp == 0) break;
      if (cp == (arr[i] + 1)) {
        if ((i + 1) < n && cp == (arr[i + 1] + 2)) {
          cp = arr[i + 1];
          ++i;
        } else {
          if ((i + 1) < n) {
            cp = arr[i + 1] + 1;
            ++ans;
          } else if (i == n - 1) {
            if (cp == 2)
              continue;
            else
              ++ans;
          }
        }
      } else {
        cp = arr[i] + 1;
        --i;
      }
    }
    cout << ans << endl;
  }
}
