#include <bits/stdc++.h>
using namespace std;
int state[4005];
int main() {
  int n, k, a, b, i, j, cnt, p, q, mn = 0, mx = 0;
  cin >> n >> k;
  for (i = 1; i <= k; i++) {
    cin >> q;
    if (q == 2)
      cin >> a, state[a] = 2;
    else if (q == 1)
      cin >> a >> b, state[a] = 1, state[b] = 2;
  }
  for (i = 1; i < n; i++) {
    if (!state[i]) {
      state[i] = 1;
      if (!state[i + 1] && i + 1 < n)
        state[i + 1] = 2, mn++, mx += 2;
      else
        mn++, mx++;
    }
  }
  cout << mn << " " << mx << endl;
}
