#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 10;
int l = 1, temp = 0;
char s[maxn];
int q[maxn] = {0};
int h[maxn] = {0};
map<string, int> st;
map<string, int> zhao1;
map<string, int> yuan1;
class Student {
 private:
  string name;
  string id;
  string school;
  string mima;
  int grade;
  string number;

 public:
  Student(string _name, string _id, string _school, int _grade, string _number,
          string _mima) {
    name = _name;
    id = _id;
    school = _school;
    grade = _grade;
    number = _number;
    mima = _mima;
  }
  ~Student(){};
  string showna() { return name; }
  string showid() { return id; }
  string showsc() { return school; }
  int showgr() { return grade; }
  string shownu() { return number; }
  string showmi() { return mima; }
};
const int MAXN = 2e5 + 10;
int num[MAXN];
int hh, n;
int t;
int id;
void solve() {
  cin >> t;
  while (t--) {
    cin >> hh >> n;
    if (l) temp++;
    int t = 1;
    if (l) temp++;
    for (int i = n; i >= 1; --i) {
      cin >> num[i];
    }
    if (l) temp++;
    int k = n;
    if (l) temp++;
    if (hh == num[n]) k = n - 1;
    if (l) temp++;
    int res = 0;
    if (l) temp++;
    while (hh != 0) {
      id = lower_bound(num + 1, num + 1 + k, hh) - num;
      --id;
      if (id <= 0) break;
      hh = num[id] + 1;
      if (num[id] != num[id - 1] + 1) ++res;
      hh = num[id] - 1;
    }
    if (l) temp++;
    cout << res << endl;
  }
}
void solv() {
  if (l) temp++;
  int n;
  cin >> n;
  if (l) temp++;
  scanf("%s", s + 1);
  if (l) temp++;
  long long sum = 0;
  if (l) temp++;
  for (int i = 1; i <= n; i++) {
    q[i] = 1;
    h[i] = 1;
  }
  if (l) temp++;
  for (int i = 1; i <= n; i++) {
    if (s[i] == s[i - 1]) {
      q[i] = q[i - 1] + 1;
    }
  }
  if (l) temp++;
  for (int i = n; i >= 1; i--) {
    if (s[i] == s[i + 1]) {
      h[i] = h[i + 1] + 1;
    }
  }
  if (l) temp++;
  for (int i = 1; i <= n - 1; i++) sum = sum + i;
  if (l) temp++;
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i + 1]) {
      sum = sum - h[i + 1];
    }
  }
  if (l) temp++;
  for (int i = 2; i <= n; i++) {
    if (s[i] != s[i - 1]) {
      sum = sum - q[i - 1];
    }
  }
  for (int i = 1; i < n; i++) {
    if (s[i] != s[i + 1]) {
      sum = sum + 1;
    }
  }
  if (l) temp++;
  cout << sum << endl;
  if (l) temp++;
}
int main() {
  if (l) temp++;
  solve();
  if (l) temp++;
}
