#include <bits/stdc++.h>
using namespace std;
int n, x, s, d, t, a, b, r[5000], l, res1, res2, k;
int main() {
  cin >> n >> k;
  for (int i = 0; i < k; i++) {
    cin >> t;
    if (t == 1) {
      cin >> a >> b;
      r[a] = r[b] = 1;
      l += 2;
    } else {
      cin >> a;
      r[a] = 1;
      l++;
    }
  }
  res2 = n - 1 - l;
  for (int i = 1; i < n; i++) {
    if (r[i] == 0) {
      if ((i < n - 1) && (r[i + 1] == 0))
        r[i] = r[i + 1] = 1, res1++;
      else
        res1++;
    }
  }
  cout << res1 << " " << res2 << endl;
  return 0;
}
