【链接】:地址-》》》》
#include<bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
#define ll long long
const int N = 2e5+5;
ll a[N],b[N],sum[N];
int main(){
int n,m;
scanf("%d%d",&n,&m);
memset(sum,0,sizeof(sum));
for(int i=1;i<=n;i++){
scanf("%lld",&a[i]);
sum[i]=sum[i-1]+a[i];
}
for(int i=1;i<=m;i++){
scanf("%lld",&b[i]);
}
for(int i=1;i<=m;i++){
ll ans;
if(b[i]<=a[1]){
printf("%d %lld\n",1,b[i]);
}
else {
ans=lower_bound(sum,sum+n,b[i])-sum; //ans返回的是位置
printf("%lld %lld\n",ans,b[i]-sum[ans-1]);
}
}
}