#include <bits/stdc++.h>
using namespace std;
template <class T>
inline istream& operator>>(istream& str, vector<T>& a) {
  for (auto& i : a) str >> i;
  return str;
}
const long long N = 1e6, mod = 1e9 + 7;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  cin >> t;
  while (t--) {
    long long h, n;
    cin >> h >> n;
    long long curr = h;
    long long cnt = 1;
    long long ans = 0;
    for (long long i = 0; i < n; i++) {
      long long x;
      cin >> x;
      if (x == curr) {
        cnt++;
        curr--;
      } else {
        if (cnt % 2) ans++;
        cnt = 1;
        curr = x - 1;
      }
    }
    if (curr != 0)
      if (cnt % 2) ans++;
    cout << ans << '\n';
  }
}
