#include <bits/stdc++.h>
using namespace std;
const int N = 101;
int x, k;
int fre[4001];
int main() {
  scanf("%d %d", &x, &k);
  string str;
  getline(cin, str);
  while (k--) {
    getline(cin, str);
    stringstream ss;
    ss << str;
    int type, t;
    ss >> type;
    while (ss >> t) {
      fre[t] = type;
    }
  }
  int mn = 0, mx = 0;
  fre[x] = 2;
  for (int i = 1; i < x; ++i) {
    if (!fre[i]) ++mx;
  }
  mn = mx;
  for (int i = x - 1; i > 1; --i) {
    if ((fre[i] == fre[i - 1] && fre[i] == 0)) {
      --mn;
      --i;
    }
  }
  printf("%d %d\n", mn, mx);
  return 0;
}
