#include <bits/stdc++.h>
int main() {
  int n, m, i, j, sum;
  int x, a, b;
  int max, min;
  int vis[4004];
  while (scanf("%d %d", &n, &m) != EOF) {
    memset(vis, 0, sizeof(vis));
    for (i = 1; i <= m; i++) {
      scanf("%d", &x);
      if (x == 1) {
        scanf("%d %d", &a, &b);
        vis[a] = 1;
        vis[b] = 1;
      } else {
        scanf("%d", &a);
        vis[a] = 1;
      }
    }
    max = 0;
    min = 0;
    for (i = 1; i < n; i++) {
      if (!vis[i]) {
        sum = 0;
        for (j = i; j < n; j++) {
          if (vis[j]) break;
          sum++;
        }
        max += sum;
        min += (sum + 1) / 2;
        i = j;
      }
    }
    printf("%d %d\n", min, max);
  }
  return 0;
}
