#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k;
  cin >> x >> k;
  vector<int> v(x + 1, 0);
  v[x] = 1;
  for (int i = 0; i < k; i++) {
    int type, div2, div1;
    cin >> type >> div2;
    if (type == 1) {
      cin >> div1;
      v[div1] = 1;
    }
    v[div2] = 1;
  }
  cout << endl;
  int cnt = 0, min_ = 0, max_ = 0;
  for (int i = 1; i <= x; i++) {
    if (v[i]) {
      if (cnt > 0) {
        min_ += cnt % 2 ? (cnt + 1) / 2 : cnt / 2;
        max_ += cnt;
        cnt = 0;
      }
      continue;
    }
    cnt++;
  }
  cout << min_ << " " << max_ << endl;
  return 0;
}
