#include <bits/stdc++.h>
using namespace std;
int id[4005];
int main() {
  int first, k, cmd, a, b;
  cin >> first >> k;
  memset(id, 0, sizeof(id));
  id[first] = 1;
  for (int i = 0; i < k; ++i) {
    cin >> cmd;
    if (cmd == 1) {
      cin >> a >> b;
      id[a] = 1;
      id[b] = 1;
    } else {
      cin >> a;
      id[a] = 1;
    }
  }
  int c = 0, mx = 0, mn = 0;
  for (int i = 1; i <= first; ++i) {
    if (!id[i])
      ++c;
    else if (c) {
      mx += c;
      mn += (c - 1) / 2 + 1;
      c = 0;
    }
  }
  if (k == 0) {
    mx = first - 1;
    if (first > 1) mn = (first - 2) / 2 + 1;
  }
  cout << mn << ' ' << mx;
}
