n,c = map(int,input().split()) p = [int(input()) for i in range(n)] p.sort(reverse=True) hiki = [] wari = [] for i in range(c): t,x = map(int,input().split()) if t == 1: hiki.append(x) else: wari.append(x) wari.sort(reverse=True) hiki.sort(reverse=True) ans = sum(p) for a in range(min(n,len(wari))+1): b = min(n-a,len(hiki)) count = sum(p) # 引きがb枚、割がa枚 wari_now = 0 hiki_now = 0 for i in range(n): if wari_now == a and hiki_now == b: continue if wari_now == a: count -= min(p[i],hiki[hiki_now]) hiki_now += 1 elif hiki_now == b: count -= p[i]//100*wari[wari_now] wari_now += 1 else: if p[i]//100*wari[wari_now]+min(p[i+1],hiki[hiki_now]) >= min(p[i],hiki[hiki_now])+p[i+1]//100*wari[wari_now]: count -= p[i]//100*wari[wari_now] wari_now += 1 else: count -= min(p[i],hiki[hiki_now]) hiki_now += 1 ans = min(ans,count) print(ans)