#include <bits/stdc++.h>
using namespace std;
int del[5005], ans[5005];
int main() {
  int n, m, t, x, y;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &t);
    if (t == 1) {
      scanf("%d%d", &x, &y);
      del[x] = del[y] = 1;
    } else {
      scanf("%d", &x);
      del[x] = 1;
    }
  }
  int la = 0, minv = 0;
  for (int i = 1; i < n; i++)
    if (!del[i]) ans[la++] = i;
  for (int i = 0; i < la; i++) {
    if (i != la - 1 && ans[i] == ans[i + 1] - 1)
      minv++, i++;
    else
      minv++;
  }
  printf("%d %d\n", minv, la);
  return 0;
}
