#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int a[N];
map<int, int> is;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  int ans = 0;
  while (t--) {
    ans = 0;
    is.clear();
    long long h, n;
    cin >> h >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    a[n] = 0;
    for (int i = 1; i < n; i++) {
      if (is[a[i] + 1]) continue;
      if (a[i] - a[i + 1] != 1) ans++;
      is[a[i]] = 1;
    }
    cout << ans << endl;
  }
  return 0;
}
