#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll p=1e9+7;
const int N=1e6+5;
int a[N],b[N];
ll qmi(ll x,ll y){//快速幂
ll res=1;
while(y){
if(y&1){
res=res*x%p;
}
y>>=1;
x=x*x%p;
}
return res;
}
int main(){
int n,q;cin>>n>>q;
for(int i=1;i<=n;i++){
cin>>a[i];
b[i]=q;//记录下每个数本来要翻倍多少次
}
while(q--){
int x;cin>>x;//对这些数少一次翻倍次数
b[x]--;
}
ll sum=0;
for(int i=1;i<=n;i++){
sum=(sum%p+a[i]*qmi(2,b[i])%p)%p;//计算和
}
cout<<sum<<endl;
return 0;
}
0 回复
0 转发
2 喜欢
2 阅读



