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