#include<bits/stdc++.h>
using namespace std;
int n,m;
int ace[100010];int ancestor(int x){return x-ace[x]?ace[x]=ancestor(ace[x]):x;}
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1; i<=n; i++)ace[i] = i;
	for(int i=0; i<m; i++){
		int x,y;
		scanf("%d%d",&x,&y);
		ace[ancestor(x)]=ancestor(y);
	}
	int sz1=0,sz2=0;
	for(int i=1; i<=n; i++){
		if(ancestor(i) == ancestor(1))sz1++;
		if(ancestor(i) == ancestor(2))sz2++;
	}
	int sz = min(sz1,sz2);
	cout << sz * (sz-1LL) / 2 + (n - sz) * (n - sz-1LL)/2 - m <<endl;
	return 0;
}
