#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:100000000")
using namespace std;
template <class T>
void out(map<char, T> &a, string s = "(%3c ->%3d)") {
  for (auto(it) = (a).begin(); (it) != (a).end(); ++(it))
    printf(s.c_str(), it->first, it->second);
  printf("\n");
}
template <class T>
void out(vector<T> &a, string s = "%3d ") {
  int i, n = a.size();
  for ((i) = 0; (i) < (n); (i)++) printf(s.c_str(), a[i]);
  printf("\n");
}
template <class T>
void out(T *a, int n, string s = "%3d ") {
  int i;
  for ((i) = 0; (i) < (n); (i)++) printf(s.c_str(), a[i]);
  printf("\n");
}
long long i, j, N, M, n, m, k, p;
void MainSolve(string args = "") {
  cout << args;
  long long x, k, z, p;
  cin >> x >> k;
  const int NMAX = 4111;
  char rnd[NMAX];
  memset(rnd, 0, sizeof(rnd));
  for ((i) = 0; (i) < (k); (i)++) {
    cin >> p;
    cin >> z;
    rnd[z] = 1;
    if (p == 1) cin >> z, rnd[z] = 1;
  }
  long long mx = 0, mn = 0, cur0 = 0;
  for ((i) = (1); (i) < (x); (i)++)
    if (rnd[i] == 0) {
      mx++;
      cur0++;
    } else {
      mn += (cur0 + 1) / 2;
      cur0 = 0;
    }
  mn += (cur0 + 1) / 2;
  cur0 = 0;
  cout << mn << " " << mx << endl;
}
string ReadAllLines(char *fileName) {
  string s = "";
  const int NMAX = 1000;
  char buf[NMAX];
  buf[0] = 0;
  FILE *f = fopen(fileName, "r");
  while (fgets(buf, NMAX, f)) s = s + string(buf);
  return string(s.begin(), find_if(s.rbegin(), s.rend(), [](char c) {
                             return c != '\n' && c != '\r' && c != '\t' &&
                                    c != ' ';
                           }).base());
}
int main() {
  MainSolve();
  return 0;
}
