#include <bits/stdc++.h>
using namespace std;
int a[200005], h, q, n;
int main() {
  scanf("%d", &q);
  while (q--) {
    memset(a, 0, sizeof(a));
    scanf("%d%d", &h, &n);
    int tmp;
    for (int i = 0; i < n; i++) {
      scanf("%d", &tmp);
      a[i] = tmp;
    }
    a[n] = 0;
    int cnt = 0;
    int i = 0;
    while (h > 0 && i < n - 1) {
      if (a[i + 1] < h - 1) {
        h = a[i + 1] + 1;
        a[i] = h;
        continue;
      }
      if (a[i + 2] == (h - 2) || h == 2) {
        h -= 2;
        i += 2;
      } else {
        cnt++;
        h -= 2;
        a[i + 1] = h;
        i++;
      }
    }
    if (h == (a[n - 2] + 1) && h > 3) cnt++;
    printf("%d\n", cnt);
  }
}
