#include <bits/stdc++.h>
using namespace std;
int ok, a, b, x, k, ans, cur, ar[50000], d, t;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> x >> k;
  for (int i = 0; i < k; i++) {
    cin >> ok;
    if (ok == 2) {
      cin >> a;
      t++;
      ar[a] = 1;
    } else {
      cin >> a >> b;
      t += 2;
      ar[a] = 2;
      ar[b] = 2;
    }
  }
  ar[x] = 1;
  for (int i = 1; i <= x; i++) {
    if (ar[i] == 0)
      cur++;
    else {
      if (cur % 2 == 0)
        d = cur / 2;
      else if (cur != 0)
        d = cur / 2 + 1;
      ans += d;
      cur = 0;
    }
  }
  cout << ans << " " << x - t - 1;
}
