#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y;
  cin >> x;
  cin >> y;
  int a[4000][3];
  int i;
  int count = 0;
  int j;
  int max, min;
  int k;
  int c;
  vector<int> b;
  int z = 0;
  int l = 0;
  for (i = 0; i < y; i++) {
    k = 2;
    c = 0;
    z = 0;
    for (j = 0; j < k; j++) {
      cin >> a[i][j];
      if (a[i][j] == 1 && c == 0) {
        k = 3;
      }
      c++;
      if (z > 0) {
        b.push_back(a[i][j]);
      }
      z++;
    }
  }
  if (y == 0) {
    min = x / 2;
    max = x - 1;
    cout << min << " " << max;
    exit(0);
  }
  sort(b.begin(), b.end());
  max = x - b.size() - 1;
  if (max == 0) {
    cout << min << " " << max;
    exit(0);
  }
  vector<int> d;
  j = 0;
  for (i = 0; i < x - 1; i++) {
    if (b[j] != i + 1)
      d.push_back(i + 1);
    else
      j++;
  }
  count = 0;
  for (i = 0; i < d.size() - 1; i++) {
    if (d[i + 1] == d[i] + 1) {
      count++;
      i++;
    }
  }
  min = x - b.size() - 1 - count;
  cout << min << " " << max;
  return 0;
}
