#include <bits/stdc++.h>
using namespace std;
void RI() {}
template <typename... T>
void RI(int& head, T&... tail) {
  scanf("%d", &head);
  RI(tail...);
}
int rec[4010], shik[4010];
int main() {
  int x, k;
  RI(x, k);
  for (int i = 0; i < (int)(k); i++) {
    int op, n1, n2;
    RI(op);
    if (op == 1) {
      RI(n2, n1);
      rec[n2] = 2;
      rec[n1] = 1;
    } else {
      RI(n2);
      rec[n2] = 2;
      rec[n2 + 1] = 2;
    }
  }
  for (int i = (int)(1); i <= (int)(x - 1); i++) {
    if (rec[i])
      shik[i] = rec[i];
    else if (shik[i - 1] == 2)
      shik[i] = 1;
    else
      shik[i] = 2;
  }
  int ans1 = count(shik, shik + x, 2) - k;
  int ans2 = x - 1 - count(rec, rec + x, 1) - k;
  printf("%d %d\n", ans1, ans2);
  return 0;
}
