#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a, b, c, s[5000] = {0};
  cin >> n >> k;
  s[n] = 1;
  while (k--) {
    cin >> a;
    if (a == 2) {
      cin >> b;
      s[b] = 1;
    } else {
      cin >> b >> c;
      s[b] = 1;
      s[c] = 1;
    }
  }
  int mx = 0, mi = 0;
  for (int i = 1; i < n; i++) {
    if (s[i] == 0) mx++;
  }
  for (int j = 1; j < n; j++) {
    if (s[j] == 0 && s[j + 1] != 0)
      mi++;
    else if (s[j] == 0 && s[j + 1] == 0) {
      mi++;
      j++;
    }
  }
  cout << mi << " " << mx << endl;
  return 0;
}
