#include<stdio.h>
int main()
{
	int i,M,N,A,Xi,Yi,k,sr,uk;

	scanf("%d %d",&N,&M);
	
	for(i = 1; i <= N; i = i + 1)
	{
		scanf("%d",&A);
	}
	for(k = 1; k <= M; k = k + 1)
	{
		scanf("%d %d",&Xi,&Yi);
	}
	sr = A * (N - 1);
	uk = N * sr;
	printf("%d",uk);
}