#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve(){
int n, k;
cin >> n >> k;
vector<int> a(n + 1), h(n + 1);
for(int i = 1; i <= n; i++) cin >> a[i] >> h[i];
vector<int> x(k);
for(int i = 0; i < k; i++) cin >> x[i];
sort(x.begin(), x.end());
set<int> used_stations;
int total_cost = 0;
for(int i = 1; i <= n; i++) {
auto it = lower_bound(x.begin(), x.end(), a[i]);
int best_dist = h[i];
int chosen_station = -1;
if(it != x.end()) {
if((*it - a[i]) < best_dist) {
best_dist = *it - a[i];
chosen_station = *it;
}
}
if(it != x.begin()) {
auto it_prev = prev(it);
if((a[i] - *it_prev) < best_dist) {
best_dist = a[i] - *it_prev;
chosen_station = *it_prev;
}
}
total_cost += best_dist;
if(chosen_station != -1) {
used_stations.insert(chosen_station);
}
}
cout << total_cost + (int)used_stations.size() << endl;
}
signed main()
{
solve();
return 0;
}