#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, x, k, a, b, c, mini = 0, maxa = 0;
  cin >> x >> k;
  long long A[x + 1];
  for (i = 0; i < x; i++) A[i] = 0;
  A[x] = 1;
  for (i = 0; i < k; i++) {
    cin >> a;
    if (a == 1) {
      cin >> b >> c;
      A[b] = 1;
      A[c] = 1;
    } else {
      cin >> b;
      A[b] = 1;
    }
  }
  if (k >= x) {
    cout << 0 << " " << 0;
    return 0;
  }
  i = 1;
  while (1) {
    if (A[i] == 0) {
      if (A[i + 1] == 0) {
        mini++;
        maxa += 2;
      } else {
        maxa++;
        mini++;
      }
      i += 2;
    } else
      i++;
    if (i >= x) break;
  }
  cout << mini << " " << maxa;
}
