using System;
using System.Linq;
using System.Collections.Generic;

namespace cs
{
    class Program
    {
        static void Main(string[] args)
        {
            var pg = new Program();
            pg.Execute();

        }

        private void Execute()
        {
            var (N, K) = ReadLinesLongList2<long>();
            var input = new List<long>();
            var count = 0;
            for (int i = 1; i <= 2 * K; i++)
            {
                var temp = ReadLinesLongList;
                if (i % 2 == 0)
                {
                    input = input.Concat(temp).ToList();
                }

            }

            for (long i = 1; i <= N; i++)
            {
                if (input.Contains(i))
                {
                    count++;
                }
            }

            OutputResult(N - count);
        }

        private void OutputResult<T>(T result)
        {
            Console.WriteLine(result);
        }

        static long ReadLineLong => long.Parse(Console.ReadLine());
        static string ReadLineString => Console.ReadLine();
        static IEnumerable<long> ReadLinesLongList => Console.ReadLine().Split(' ').Select(i => long.Parse(i));
        static IEnumerable<string> ReadLinesStringList => Console.ReadLine().Split(' ');

        public static (T, T) ReadLinesLongList2<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T)Convert.ChangeType(input.ElementAt(0), typeof(T)), (T)Convert.ChangeType(input.ElementAt(1), typeof(T)));
        }

        public static (T, T, T) ReadLinesLongList3<T>()
        {
            var input = Console.ReadLine().Split(' ');
            return ((T)Convert.ChangeType(input.ElementAt(0), typeof(T)), (T)Convert.ChangeType(input.ElementAt(1), typeof(T)), (T)Convert.ChangeType(input.ElementAt(2), typeof(T)));
        }

        public static List<long> ReadLineNTimes()
        {
            var input = new List<long>();
            var N = long.Parse(Console.ReadLine());
            for (int i = 0; i < N; i++)
            {
                input.Add(long.Parse(Console.ReadLine()));
            }
            return input;
        }

        public static List<long> ReadLineNTimes(long N)
        {
            var input = new List<long>();
            for (int i = 0; i < N; i++)
            {
                input.Add(long.Parse(Console.ReadLine()));
            }
            return input;
        }

        public static List<string> ReadLineNTimesString()
        {
            var input = new List<string>();
            var N = long.Parse(Console.ReadLine());
            for (int i = 0; i < N; i++)
            {
                input.Add(Console.ReadLine());
            }
            return input;
        }

        private int SolveDynamicProgramming(int n)
        {
            var inputList = new List<int>() { 7, -6, 9 };
            var dpList = new List<int>() { 0 };
            for (int i = 0; i < n; ++i)
            {
                dpList.Add(Math.Max(dpList[i], dpList[i] + inputList[i]));
            }

            return dpList[n];
        }

        private int SolveDynamicProgrammingForKnapsack(int n, int weight, List<int> valueList, List<int> weightList)
        {
            var dpList = new List<List<int>>();

            for (int i = 0; i < n + 1; ++i)
            {
                dpList.Add(Enumerable.Repeat(0, weight + 1).ToList());
            }

            for (int i = 0; i < n; ++i)
            {
                for (int w = 0; w <= weight; ++w)
                {
                    if (w >= weightList[i])
                    {
                        dpList[i + 1][w] = Math.Max(dpList[i][w - weightList[i]] + valueList[i], dpList[i][w]);
                    }
                    else
                    {
                        dpList[i + 1][w] = dpList[i][w];
                    }
                }
            }

            return dpList[n][weight];
        }

        public static int Gcd(int a, int b)
        {
            Func<int, int, int> gcd = null;
            gcd = (x, y) => y == 0 ? x : gcd(y, x % y);
            return a > b ? gcd(a, b) : gcd(b, a);
        }

    }
}


Measured memory_bytes: 32420