#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int inf = 1000000007;
const int M = 505;
int c[5005];
int main() {
  int x, k;
  cin >> x >> k;
  for (int i = 0; i < k; i++) {
    int kind;
    cin >> kind;
    if (kind == 1) {
      int a, b;
      cin >> a >> b;
      if (a <= x) c[a] = c[b] = 1;
    } else {
      int a;
      cin >> a;
      if (a <= x) c[a] = 1;
    }
  }
  c[x] = 1;
  int mn = 0, mx = 0, cnt = 0;
  for (int i = 1; i <= x; i++) {
    if (c[i] == 1) {
      mx += cnt;
      mn += (cnt + 1) / 2;
      cnt = 0;
    } else
      cnt++;
  }
  cout << mn << " " << mx << endl;
  return 0;
}
