#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, m, x, y;
  cin >> n >> m;
  vector<int> a(4001, 0);
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x == 1) {
      cin >> y;
      a[y] = 1;
      cin >> y;
      a[y] = 1;
    } else if (x == 2) {
      cin >> y;
      a[y] = 1;
    }
  }
  int cnt = 0, cnt2 = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == 0) cnt++;
  }
  for (int i = 2; i < n; i++) {
    if (a[i] == 0 && a[i - 1] == 0) {
      cnt2++;
      i++;
    }
  }
  cout << cnt - cnt2 << ' ' << cnt << endl;
  return 0;
}
