#include <bits/stdc++.h>
using namespace std;
void solv();
int main() { solv(); }
int a[100000];
void solv() {
  int n, m;
  cin >> n >> m;
  while (m--) {
    int x;
    cin >> x;
    if (x == 1) {
      int a1, b;
      cin >> a1 >> b;
      a[a1] = 1;
      a[b] = 1;
    } else {
      int x1;
      cin >> x1;
      a[x1] = 1;
    }
  }
  int mx = 0;
  for (int i = 1; i < n; i++) {
    if (!a[i]) mx++;
  }
  int mn = 0;
  for (int i = 1; i < n; i++) {
    if (!a[i] && !a[i + 1]) {
      mn += 1;
      a[i + 1] = 1;
      continue;
    }
    if (!a[i] && a[i + 1]) {
      mn++;
    }
  }
  cout << mn << ' ' << mx;
}
