#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y;
  point() {}
  point(int a, int b) { x = a, y = b; }
};
template <class T>
T sqr(T a) {
  return a * a;
}
template <class T>
T power(T n, T p) {
  T res = 1;
  for (int i = 0; i < p; i++) res *= n;
  return res;
}
template <class T>
double getdist(T a, T b) {
  return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
template <class T>
T extract(string s, T ret) {
  stringstream ss(s);
  ss >> ret;
  return ret;
}
template <class T>
string tostring(T n) {
  stringstream ss;
  ss << n;
  return ss.str();
}
template <class T>
inline T Mod(T n, T m) {
  return (n % m + m) % m;
}
template <class T>
void print_all(T v) {
  for (int i = 0; i < v.size(); i++) cout << v[i] << ' ';
};
template <class T>
void print_all(T &v, int len) {
  for (int i = 0; i < len; i++) cout << v[i] << ' ';
}
template <class T>
void print_pair(T v, int len) {
  for (int i = 0; i < len; i++)
    cout << v[i].first << ' ' << v[i].second << endl;
}
int arr[5010];
int main() {
  int n, x, i, mn, mx, tem;
  cin >> n >> x;
  memset(arr, 0, sizeof arr);
  arr[n] = 1;
  for (i = 0; i < x; i++) {
    cin >> tem;
    if (tem == 1)
      cin >> mx >> mn, arr[mn] = arr[mx] = 1;
    else
      cin >> mn, arr[mn] = 1;
  }
  mx = 0;
  for (i = 1; i < n; i++) mx += (arr[i] == 0);
  mn = 0;
  for (i = 1; i < n; i++) {
    if (arr[i] == 0 && arr[i + 1] == 0)
      mn++, i++;
    else if (arr[i] == 0)
      mn++;
  }
  cout << mn << ' ' << mx << endl;
  return 0;
}
