N, C = map(int, input().split()) P = [] for _ in range(N): P.append(int(input())) P.sort(reverse=True) TY = [] TP = [] for _ in range(C): T, X = map(int, input().split()) if T == 1: TY.append(X) else: TP.append(X) TY.sort(reverse=True) TP.sort(reverse=True) L = len(TY) DP = [[float('inf')] * (L+1) for _ in range(N+1)] DP[0][0] = 0 for i in range(N): for j in range(L+1): if i-j < 0: cost = 0 elif i-j < len(TP): cost = P[i] * (100 - TP[i-j]) // 100 else: cost = P[i] DP[i+1][j] = min(DP[i+1][j], DP[i][j] + cost) if j < L: cost = P[i] - min(P[i], TY[j]) DP[i+1][j+1] = min(DP[i+1][j+1], DP[i][j] + cost) print(min(DP[N]))