#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const double EPS = 1e-9;
int mods(int a, int b) { return (b + (a % b)) % b; }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int x, k, type, div2, div1, minimum = 0, maximum = 0;
  bitset<4005> rounds;
  cin >> x >> k;
  rounds[x] = 1;
  for (int i = 0; i < k; i++) {
    cin >> type;
    if (type == 1) {
      cin >> div2 >> div1;
      rounds[div2] = rounds[div1] = 1;
    } else {
      cin >> div2;
      rounds[div2] = 1;
    }
  }
  for (int i = 1; i <= x; i++) {
    if (!rounds[i]) {
      maximum++;
      minimum++;
      if (i + 1 <= x && !rounds[i + 1]) {
        maximum++;
        i++;
      }
    }
  }
  cout << minimum << " " << maximum << '\n';
  return 0;
}
