#include <bits/stdc++.h>
using namespace std;
int T, n, a[200010], ans;
int main() {
  cin >> T;
  while (T--) {
    ans = 0;
    cin >> a[0] >> n;
    ++a[0];
    for (int i = 1; i <= n; ++i) cin >> a[i];
    for (int t = 1, i = 1; i <= n; ++i) {
      if (a[i] + 1 == a[i - 1])
        ++t;
      else {
        if (t & 1) ++ans;
        t = 1;
      }
      if (i == n && a[n] > 1 && (t & 1)) ++ans;
    }
    cout << ans << endl;
  }
}
