#include <bits/stdc++.h>
const double PI = 3.141592653589793238460;
using namespace std;
vector<int> v;
int main() {
  long long int x, k, num1, num2, val, num, mini = 0, l;
  cin >> x >> k;
  x--;
  while (k--) {
    cin >> val;
    if (val == 1) {
      cin >> num1 >> num2;
      v.push_back(num1);
      v.push_back(num2);
    } else {
      cin >> num;
      v.push_back(num);
    }
  }
  sort(v.begin(), v.end());
  if (v.empty())
    cout << (x / 2) + (x % 2) << " " << x << endl;
  else {
    l = v.size();
    if (v[0] > 1) mini += ((v[0] - 1) / 2) + ((v[0] - 1) % 2);
    if (v[l - 1] != x) mini += ((x - v[l - 1]) / 2) + ((x - v[l - 1]) % 2);
    for (int i = int(1); i <= int(v.size() - 1); i++) {
      if (v[i] - v[i - 1] > 1)
        mini += ((v[i] - v[i - 1] - 1) / 2) + ((v[i] - v[i - 1] - 1) % 2);
    }
    cout << mini << " " << x - v.size();
  }
  return 0;
}
