#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  int t;
  cin >> t;
  while (t--) {
    int h, n;
    cin >> h >> n;
    vector<int> height(n + 1, 0);
    for (int i = 0; i < n; ++i) {
      cin >> height[i];
    }
    int ans = 0;
    for (int i = 1; i < n; ++i) {
      h = min(h, height[i] + 1);
      if (h - 2 > height[i + 1]) {
        ans++;
        h--;
      } else {
        h = height[++i];
      }
    }
    cout << ans << "\n";
  }
  return 0;
}
