#include <bits/stdc++.h>
using namespace std;
int x, N, maxans, minans, now;
struct Query {
  int num1, num2;
} a[4005];
inline bool cmp(const Query &a, const Query &b) { return a.num2 < b.num2; }
int main() {
  scanf("%d%d", &now, &N);
  for (int i = 1; i <= N; ++i) {
    scanf("%d", &x);
    if (x == 1)
      scanf("%d%d", &a[i].num2, &a[i].num1);
    else
      scanf("%d", &a[i].num2);
  }
  sort(a + 1, a + 1 + N, cmp);
  a[++N].num2 = now;
  for (int i = 1; i <= N; ++i) {
    if (!a[i].num1) a[i].num1 = a[i].num2;
    maxans += a[i].num2 - a[i - 1].num1 - 1;
    minans += a[i].num2 - a[i - 1].num1 >> 1;
  }
  printf("%d %d\n", minans, maxans);
}
