#import <Foundation/Foundation.h>
typedef long long INT;
int main(){
    @autoreleasepool {
        INT N,M;
        scanf("%lld %lld",&N,&M);
        NSMutableArray *array = [NSMutableArray array];
        for(INT i=0;i<N;i++){
            INT a;
            scanf("%lld",&a);
            [array addObject:@(a)];
        }
        for(INT i=0;i<M;i++){
            INT b,c;
            scanf("%lld %lld",&b,&c);
            for(INT j=0;j<b;j++){
                [array addObject:@(c)];
            }
        }
        NSSortDescriptor *descriptor = [[[NSSortDescriptor alloc] initWithKey: @"self" ascending: NO] autorelease];
        array = [array sortedArrayUsingDescriptors: @[descriptor]];
        INT sum=0;
        for(INT i=0;i<N;i++){
            sum += [[array objectAtIndex:i] longLongValue];
        }
        printf("%lld",sum);
    }
}
