#include<iostream>
using namespace std;
struct wood
{
long long x1;
long long x2;
long long s;
}mb[200001];
struct trees
{
wood a[4000];
long long num=0;
}X[20000];
int main()
{
freopen("shooting.in","r",stdin);
freopen("shooting.out","w",stdout);
long long n,m,x;
cin>>n>>m;
long long sx[200001]={0},numm=0;
for(long long i=1;i<=n;i++)
{
cin>>mb[i].x1>>mb[i].x2>>mb[i].s;
for(long long j=mb[i].x1;j<=mb[i].x2;j++)
{
X[j].num++;
X[j].a[X[j].num]=mb[i];
}
}
for(long long i=1;i<=m;i++)
{
cin>>x;
for(long long j=1;j<=X[x].num;j++)
{
X[x].a[j].s--;
if(X[x].a[j].s==0)
{
sx[i]++;
}
}
}
for(long long i=1;i<=m;i++)
{
cout<<sx[i]<<endl;
}
return 0;
}