#include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    long long n, m;
    scanf("%lld%lld", &n, &m);
    for (int i = 0; i < m; i++) {
      scanf("%d", &a[i]);
    }
    a[m] = 0;
    long long ans = 0;
    int x = a[0];
    for (int i = 1; i < m; i++) {
      if (x - a[i] == 1 && a[i] - a[i + 1] >= 2) {
        ans++;
        x = a[i] - 1;
      } else if (x - a[i] == 1 && a[i] - a[i + 1] == 1) {
        x = a[i + 1];
        i++;
      } else if (x - a[i] >= 2) {
        x = a[i] + 1;
        i--;
      }
    }
    printf("%lld\n", ans);
  }
}
