#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int p[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int q;
  cin >> q;
  while (q--) {
    int n, h;
    cin >> h >> n;
    for (int i = 0; i < n; i++) cin >> p[i];
    p[n] = 0;
    int ans = 0;
    bool flag = true;
    for (int i = 0; i < n; i++)
      if (flag)
        flag = false;
      else {
        if (p[i] != p[i + 1] + 1)
          ans++;
        else
          flag = true;
      }
    cout << ans << "\n";
  }
  return 0;
}
