#include <bits/stdc++.h>
using namespace std;
int a[10000];
int main() {
  int x, k, i, j, max = 0, min = 0, b, c, g, q;
  cin >> x >> k;
  a[x] = 1;
  for (i = 1; i <= k; i++) {
    cin >> g;
    if (g == 1) {
      cin >> b >> c;
      a[b]++;
      a[c]++;
    } else {
      cin >> q;
      a[q]++;
    }
  }
  for (i = 1; i < x; i++) {
    if (a[i] == 0) max++;
  }
  for (i = 1; i < x; i++) {
    if (a[i] == 0 && a[i + 1] == 0) {
      min++;
      a[i] = 1;
      a[i + 1] = 1;
    }
  }
  for (i = 1; i < x; i++) {
    if (a[i] == 0) min++;
  }
  cout << min << " " << max;
}
