#include <bits/stdc++.h>
using namespace std;
const int maxx = 4e3 + 10;
bool missed[maxx];
int main() {
  memset(missed, 1, sizeof(missed));
  int x, k;
  cin >> x >> k;
  int o, d2, d1;
  int d1cnt = 0;
  for (int i = 0; i < k; i++) {
    cin >> o;
    if (o == 1) {
      cin >> d2 >> d1;
      missed[d2] = missed[d1] = false;
      d1cnt++;
    } else {
      cin >> d2;
      missed[d2] = false;
    }
  }
  int paircnt = 0;
  bool premissed = false;
  for (int i = 1; i < x; i++) {
    if (missed[i]) {
      if (premissed) {
        paircnt++;
        premissed = false;
      } else {
        premissed = true;
      }
    } else {
      premissed = false;
    }
  }
  x--;
  cout << (x - k - d1cnt) - paircnt << " " << (x - k - d1cnt) << endl;
  return 0;
}
