#include <bits/stdc++.h>
using namespace std;
void solve() {
  int x, k;
  cin >> x >> k;
  vector<int> v(x + 1);
  while (k--) {
    int a, b, c;
    cin >> a;
    if (a == 2) {
      cin >> b;
      v[b]++;
    } else {
      cin >> b >> c;
      v[b]++;
      v[c]++;
    }
  }
  int mn = 0, mx = 0;
  for (int i = 1; i < x; i++) {
    if (v[i] == 0) mx++;
  }
  for (int i = 2; i < x; i++) {
    if (v[i - 1] == 0 && v[i] == 0) {
      mn++;
      i++;
    }
  }
  mn += (mx - (2 * mn));
  cout << mn << " " << mx << endl;
}
int main() {
  solve();
  return 0;
}
