#include <bits/stdc++.h>
using namespace std;
const long long int M = 4e4 + 7;
long long int mipos[M], mapos[M];
int main() {
  long long int x, k, i;
  cin >> x >> k;
  for (i = 0; i < k; i++) {
    long long int t, a, b;
    cin >> t;
    if (t == 1) {
      cin >> a >> b;
      mipos[a] = 1;
      mapos[b] = 1;
      mipos[b] = 1;
      mapos[a] = 1;
    } else {
      cin >> a;
      mipos[a] = 1;
      mapos[a] = 1;
    }
  }
  long long int amin = 0, amax = 0;
  for (i = 1; i < x; i++) {
    if (mapos[i] != 1) amax++;
  }
  for (i = 1; i < x; i++) {
    if (mipos[i] != 1 && mipos[i + 1] != 1 && i < x - 1) {
      amin++;
      i++;
    } else if (mipos[i] != 1) {
      amin++;
    }
  }
  cout << amin << ' ' << amax << endl;
  return 0;
}
