#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[100001];
set<long long int> s;
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
void solve() {
  long long int n, i, j, q, k, cnt = 0, mx = 0, sum = 0, left = 0, right = 0;
  long long int a, b, c, d, r;
  map<long long int, long long int> m;
  cin >> q;
  for (j = 0; j < q; j++) {
    cin >> a >> n;
    vector<long long int> v(n);
    cnt = 0;
    for (i = 0; i < n; i++) cin >> v[i];
    i = 1;
    while (a > 0) {
      if (i >= n) break;
      if (a - v[i] > 1) {
        a = v[i] + 1;
      } else {
        if (i + 1 < n && a - v[i + 1] == 2) {
          a = v[i + 1];
          i = i + 2;
        } else {
          if (a < 3)
            break;
          else {
            cnt++;
            a = v[i];
            i++;
          }
        }
      }
    }
    cout << cnt << endl;
  }
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int tt = 1.0 * clock();
  int t;
  t = 1;
  for (int y = 0; y < t; y++) {
    solve();
  }
  return 0;
}
