#include <bits/stdc++.h>
using namespace std;
int AB(int a) {
  if (a < 0) return -a;
  return a;
}
int mark[4005];
int main() {
  int x, k, i, y, a, mx, mn;
  cin >> x >> k;
  memset(mark, 0, sizeof(mark));
  int dit = 0;
  for (i = 0; i < k; i++) {
    cin >> y >> a;
    mark[a] = 3;
    dit++;
    if (y == 1) {
      cin >> a;
      dit++;
    }
    mark[a] = 3;
  }
  mx = x - 1 - dit;
  mark[0] = 3;
  for (i = 1; i < x; i++) {
    if (mark[i] == 3) continue;
    if (mark[i - 1] == 2)
      mark[i] = 1;
    else
      mark[i] = 2;
  }
  mn = 0;
  for (i = 1; i < x; i++) {
    if (mark[i] == 2) mn++;
  }
  printf("%d %d\n", mn, mx);
  return 0;
}
