#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> a;
  int type, iden1, iden2;
  int count = 0;
  a.push_back(n);
  count++;
  for (int i = 0; i < k; i++) {
    cin >> type;
    if (type == 2) {
      cin >> iden1;
      a.push_back(iden1);
      count++;
    } else {
      cin >> iden1 >> iden2;
      a.push_back(iden1);
      a.push_back(iden2);
      count = count + 2;
    }
  }
  sort(a.begin(), a.begin() + count);
  int prev = 0;
  int gap = 0;
  int mx = 0;
  int mn = 0;
  for (int i = 0; i < count; i++) {
    gap = a[i] - prev - 1;
    mn += (gap / 2);
    if (gap % 2) mn++;
    mx += gap;
    prev = a[i];
  }
  cout << mn << " " << mx << endl;
  return 0;
}
