from networkx import*

n,*t=[t.split()for t in open(0)]

n,m=list(map(int,n))

g=Graph()

g.add_edges_from(t)

try:a,b=list(map(len,bipartite.sets(g)));a*=b

except:a=n*~-n//2

print((a-m))
from networkx import*

n,*t=list(map(str.split,open(0)))

n,m=list(map(int,n))

g=Graph()

g.add_edges_from(t)

try:a,b=list(map(len,bipartite.sets(g)));a*=b

except:a=n*~-n//2

print((a-m))
from networkx import *

n, *t = [t.split() for t in open(0)]
n, m = list(map(int, n))
g = Graph()
g.add_edges_from(t)
try:
    a, b = list(map(len, bipartite.sets(g)))
    a *= b
except:
    a = n * ~-n // 2
print((a - m))

from networkx import *

n, *t = list(map(str.split, open(0)))
n, m = list(map(int, n))
g = Graph()
g.add_edges_from(t)
try:
    a, b = list(map(len, bipartite.sets(g)))
    a *= b
except:
    a = n * ~-n // 2
print((a - m))

-n, *t = [t.split() for t in open(0)] +n, *t = list(map(str.split, open(0)))