#include <bits/stdc++.h>
using namespace std;
int mabs(int a) {
  if (a < 0)
    return -a;
  else
    return a;
}
bool vis[4010];
int main() {
  int x, k;
  int t, n1, n2;
  cin >> x >> k;
  for (int i = 0; i < k; ++i) {
    cin >> t;
    if (t == 2) {
      cin >> n2;
      vis[n2] = true;
    } else {
      cin >> n2 >> n1;
      vis[n2] = vis[n1] = true;
    }
  }
  vector<int> v;
  for (int i = 1; i < x; ++i)
    if (!vis[i]) v.push_back(i);
  int ret = 0;
  for (int i = 1; i < v.size(); ++i) {
    if (v[i] - v[i - 1] == 1) ++ret, ++i;
  }
  cout << ret + v.size() - ret * 2 << " " << v.size() << endl;
  return 0;
}
