#include <bits/stdc++.h>
using namespace std;
int n, k, type, a, b, minn, maxx;
vector<int> v;
int main() {
  scanf("%d %d", &k, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &type);
    if (type == 1) {
      scanf("%d %d", &a, &b);
      v.push_back(a);
      v.push_back(b);
    } else {
      scanf("%d", &a);
      v.push_back(a);
    }
  }
  v.push_back(k);
  sort(v.begin(), v.end());
  int last = 0;
  for (typeof(v.begin()) it = v.begin(); it != v.end(); ++it) {
    minn += (*it - last) / 2;
    maxx += (*it - last - 1);
    last = *it;
  }
  printf("%d %d\n", minn, maxx);
  return 0;
}
