#include <iostream>
#include <cstdio>
#include <fstream>
using namespace std;
ifstream fin("shooting.in");
ofstream fout("shooting.out");
int sum=0,s=0;
int a[10000],b[10000],c[10000],d[10000],ans[10000];
int main (){
int n,m;
fin>>n>>m;
for (int i=0;i<n;i++){
ans[i]=0;
}
for (int i=0;i<n;i++){
fin>>a[i]>>b[i]>>c[i];
}
for (int i=0;i<m;i++){
fin>>d[i];
}
for (int i=0;i<m;i++){
for (int j=0;j<n;j++){
if(d[i]>=a[j]&&d[i]<=b[j]){
ans[j]++;}
for (int r=0;r<n;r++){
if(ans[r]>=c[r]){
sum++;
ans[r]=-100;
}
}
} fout<<sum;
}
return 0;
}