#include <bits/stdc++.h>
int a[5000];
using namespace std;
int main() {
  int x, k;
  cin >> x >> k;
  int pos = 0;
  for (int i = 0; i < k; ++i) {
    int t, u, v;
    cin >> t;
    if (t == 1) {
      cin >> u >> v;
      a[pos++] = u;
      a[pos++] = v;
    } else {
      cin >> u;
      a[pos++] = u;
    }
  }
  a[pos++] = x;
  sort(a, a + pos);
  int mn = 0, mx = 0;
  int ini = 0;
  for (int i = 0; i < pos; ++i) {
    mn += (a[i] - ini - 1) / 2 + (a[i] - ini - 1) % 2;
    mx += (a[i] - ini - 1);
    ini = a[i];
  }
  cout << mn << " " << mx << endl;
  return 0;
}
