#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k;
  int type, num1, num2;
  int min_rounds = 0, max_rounds = 0;
  bool rounds[4002] = {false};
  cin >> x >> k;
  max_rounds = x - 1;
  rounds[x] = true;
  for (int i = 0; i < k; i++) {
    cin >> type;
    if (type == 1) {
      cin >> num1 >> num2;
      max_rounds -= 2;
      rounds[num1] = true;
      rounds[num2] = true;
    } else {
      cin >> num2;
      max_rounds -= 1;
      rounds[num2] = true;
    }
  }
  min_rounds = 0;
  for (int i = 1; i < x; i++) {
    if (!rounds[i]) {
      min_rounds++;
      if (!rounds[i + 1]) i++;
    }
  }
  cout << min_rounds << " " << max_rounds << endl;
  return 0;
}
