#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, k;
  cin >> x >> k;
  vector<char> v(x);
  v[x - 1] = 1;
  for (int i = 0; i < k; ++i) {
    int tmp, tmp1, tmp2;
    cin >> tmp;
    if (tmp == 1) {
      cin >> tmp1 >> tmp2;
      v[tmp1 - 1] = 1;
      v[tmp2 - 1] = 1;
    } else if (tmp == 2) {
      cin >> tmp1;
      v[tmp1 - 1] = 1;
    }
  }
  int ans_min = 0, ans_max = 0;
  for (int i = 0;;) {
    int n = 0;
    while (!v[i]) {
      ++i;
      ++n;
    }
    ans_min += (n / 2) + (n % 2);
    ans_max += n;
    ++i;
    if (i == x) break;
  }
  cout << ans_min << " " << ans_max;
  return 0;
}
