Skip to content

Instantly share code, notes, and snippets.

@lethe2211
Created December 9, 2014 10:33
Show Gist options
  • Save lethe2211/6c57f000efb3f15a63ea to your computer and use it in GitHub Desktop.
Save lethe2211/6c57f000efb3f15a63ea to your computer and use it in GitHub Desktop.
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
class Hoge(object):
def __init__(self):
pass
def func(self):
'''
insert your code
'''
n, m = map(int, raw_input().split())
p = map(int, raw_input().split())
s = map(int, raw_input().split())
count = 0
for i, e in enumerate(p):
if i + 1 in s:
count += e
print count
return None
if __name__ == '__main__':
h = Hoge()
h.func()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment