#import "NSArray-Extension.h"
#import <stdlib.h>

int compare_int(const void *a, const void *b) {
    long A = *(long*)a;
    long B = *(long*)b;
    return (B>A) ? 1 : (B==A) ? 0 : -1 ;
}

int main(){
    @autoreleasepool {
        long N,M;
        scanf("%ld %ld",&N,&M);
        NSMutableArray *array = [NSMutableArray array];
        long min = LONG_MAX;
        for(long i=0;i<N;i++){
            long a;
            scanf("%ld",&a);
            min = MIN(min,a);
            [array addObject:@(a)];
        }
        long total = N;
        for(long i=0;i<M;i++){
            long b,c;
            scanf("%ld %ld",&b,&c);
            if(c<=min){
                continue;
            }
            total += b;
            for(long j=0;j<b;j++){
                [array addObject:@(c)];
            }
        }
        long *ary = [array integerCArray];
        qsort(ary, total, sizeof(long), compare_int);
        long sum=0;
        for(long i=0;i<N;i++){
            sum += ary[i];
        }
        printf("%ld",sum);
    }
}
