#include <bits/stdc++.h>
using namespace std;
const int N = 10010;
const int M = 1000010;
const int MOD = 2008;
const int INF = 0x7fffffff;
const int dir4[4][2] = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}};
const int dir8[8][2] = {{-1, 0}, {1, 0},  {0, -1},  {0, 1},
                        {-1, 1}, {1, -1}, {-1, -1}, {1, 1}};
const double eps = 1e-16;
const double PI = acos(-1.0);
inline int sign(double x) { return (x > eps) - (x < -eps); }
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
inline T Min(T a, T b) {
  return a < b ? a : b;
}
template <class T>
inline T Max(T a, T b) {
  return a > b ? a : b;
}
int vis[4010];
int main() {
  int x, k, a, b, c;
  while (scanf("%d%d", &(x), &(k)) != EOF) {
    (memset((vis), 0, sizeof(vis)));
    int s = x - 1;
    for (int i = 0; i < (k); i++) {
      scanf("%d", &(a));
      if (a == 2) {
        scanf("%d", &(b));
        vis[b] = 1;
        s--;
      } else {
        scanf("%d%d", &(b), &(c));
        vis[b] = vis[c] = 1;
        s -= 2;
      }
    }
    int r = 0;
    for (int i = 1; i < x - 1; i++) {
      if (!vis[i] && !vis[i + 1]) r++, i++;
    }
    printf("%d %d\n", s - r, s);
  }
  return 0;
}
