#include <bits/stdc++.h>
using namespace std;
int main() {
  int mn = 0, mx = 0, n, x, y, z;
  bool a[4001];
  memset(a, 0, sizeof(a));
  cin >> x >> n;
  for (int i = 0; i < n; i++) {
    int xx;
    cin >> xx;
    if (xx == 1) {
      cin >> y >> z;
      a[z] = a[y] = 1;
    } else {
      cin >> y;
      a[y] = 1;
    }
  }
  for (int i = 1; i < x; i++) {
    int c = 0;
    while (i < x && a[i] == 0) {
      c++;
      i++;
    }
    mn += ceil(c / 2.0);
    mx += c;
  }
  cout << mn << ' ' << mx << '\n';
  return 0;
}
