#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5, inf = 1e9;
vector<pair<long long, long long> > v;
signed main() {
  long long x, k, n1, n2, ans1 = 0, ans2 = 0;
  cin >> x >> k;
  for (long long i = 0; i < k; i++) {
    long long t;
    cin >> t;
    if (t == 1) {
      cin >> n1 >> n2;
      if (n1 > n2) {
        swap(n1, n2);
      }
      v.push_back({n1, n2});
    } else {
      cin >> n1;
      v.push_back({n1, n1});
    }
  }
  v.push_back({x, x});
  v.push_back({0, 0});
  sort(v.begin(), v.end());
  for (long long i = 0; i < v.size() - 1; i++) {
    ans1 += v[i + 1].first - v[i].second - 1;
    ans2 += (v[i + 1].first - v[i].second) / 2;
  }
  cout << ans2 << ' ' << ans1;
}
