#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[5000] = {0};
  cin >> n >> k;
  for (int i = 1; i <= k; i++) {
    int la = 0;
    cin >> la;
    if (la == 1) {
      int p, q;
      cin >> p >> q;
      a[p] = 1;
      a[q] = 1;
    } else if (la == 2) {
      int p;
      cin >> p;
      a[p] = 1;
    }
  }
  int w = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] == 0) {
      w++;
    }
  }
  int max = w, min = w + 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && a[i + 1] == 0) {
      min--;
      i++;
    }
  }
  cout << min << " " << max << endl;
}
