#include <bits/stdc++.h>
using namespace std;
int n, x;
int type, a, b;
int mn, mx;
bool used[5000];
int main() {
  cin >> x >> n;
  used[x] = true;
  for (int i = 0; i < n; ++i) {
    cin >> type >> a;
    used[a] = true;
    if (type == 1) {
      cin >> b;
      used[b] = true;
    }
  }
  for (int i = 1; i <= x; ++i) {
    if (used[i]) {
      continue;
    }
    int j = i;
    while (j <= x && !used[j]) {
      ++j;
    }
    mx += j - i;
    mn += (j - i + 1) / 2;
    i = j;
  }
  cout << mn << " " << mx;
  return 0;
}
