#include <bits/stdc++.h>
using namespace std;
static int n, k, x, nums1, nums2;
static int _round[4010];
int main() {
  while (scanf("%d%d", &n, &k) != EOF) {
    fill(_round, _round + n + 1, 0);
    for (int i = 0; i < k; i++) {
      scanf("%d", &x);
      if (x == 2) {
        scanf("%d", &nums1);
        _round[nums1] = 1;
      } else {
        scanf("%d%d", &nums1, &nums2);
        _round[nums1] = _round[nums2] = 1;
      }
    }
    int ans1 = 0, ans2 = 0;
    for (int i = 1; i < n;) {
      int j = i;
      while (j < n && _round[j] == 0) ++j;
      if (j > i) {
        ans2 += j - i;
        ans1 += ((j - i) % 2 == 0 ? (j - i) / 2 : (j - i) / 2 + 1);
        i = j;
      } else
        i = j + 1;
    }
    printf("%d %d\n", ans1, ans2);
  }
  return 0;
}
