int main(){
    long long s = 0, N, Q;
   
    scanf("%lld", &N);
  
    scanf("%lld", &Q);
    long long d[N], p[N], k[Q];
    for (int i = 0; i < N; i++) {
        
        scanf("%lld", &d[i]);
        
        scanf("%lld", &p[i]);
    }
    for (int j = 0; j < Q; j++) {
       
        scanf("%lld", &k[j]);
    }
    for (int j = 0; j < Q; j++) {
        long long zd = k[j],s= 0,brp= 0;
        for (int i = 0; i < N; i++) {
            if (d[i] > zd)
                break;
            brp+= p[i];
            long long pd;
            if (i == N - 1 || d[i + 1] > zd) {
    pd = zd - d[i] + 1;
}
 else {
    pd = d[i + 1] - d[i];
}
            if (pd > brp) {
                s+= brp;
                brp = 0;
            } else {
                s += pd;
                brp -= pd;
            }
        }
        printf("Cerka je pojela %lld pakovanja do %lld. dana.", s, zd);
    }
    return 0;
}