#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int q;
  cin >> q;
lb:
  while (q-- > 0) {
    long long int h, n;
    cin >> h >> n;
    long long int arr[n];
    long long int ans = 0;
    for (int i = 0; i < n; i++) cin >> arr[i];
    if (n == 1) {
      cout << "0\n";
      goto lb;
    }
    for (int i = 0; i < n; i++) {
      if (i == n - 2) {
        if (arr[n - 1] >= 2) ans++;
        break;
      }
      if (i == n - 1) break;
      if (i < n - 2) {
        if (arr[i] - 1 == arr[i + 1]) {
          if (arr[i + 1] - 1 == arr[i + 2])
            i++;
          else {
            arr[i + 1] = arr[i + 1] - 1;
            ans++;
          }
        } else {
          arr[i] = arr[i + 1] + 1;
          i--;
        }
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
