#include <bits/stdc++.h>
using namespace std;
int f[1000005];
int main() {
  int n, k;
  while (cin >> n >> k) {
    int rmin = 0, rmax = 0;
    memset(f, 0, sizeof(f));
    for (int i = 0; i < k; i++) {
      int x;
      cin >> x;
      if (x == 2) {
        int a;
        cin >> a;
        f[a] = 1;
      } else {
        int a, b;
        cin >> a >> b;
        f[a] = 1;
        f[b] = 1;
      }
    }
    int cnt = 0;
    for (int i = 1; i < n; i++) {
      if (f[i]) {
        rmin += ((cnt + 1) / 2);
        rmax += cnt;
        cnt = 0;
      } else
        cnt++;
    }
    rmin += (cnt + 1) / 2;
    rmax += cnt;
    if (k == 0) {
      rmin = n / 2;
      rmax = n - 1;
    }
    cout << rmin << " " << rmax << endl;
  }
}
