#include <bits/stdc++.h>
using namespace std;
void pr_init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void solve() {
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long h, n;
    cin >> h >> n;
    long long p[n];
    for (long long i = 0; i < n; i++) cin >> p[i];
    long long cn = 0, pr = h;
    for (long long i = 0; i < n; i++) {
      if (p[i] == h) continue;
      if (p[i] == pr) {
        cn--;
        continue;
      }
      if (pr <= 2 || p[i] == 1) break;
      pr = p[i] - 1;
      cn++;
    }
    cout << cn << endl;
  }
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
