#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;

int main(void)
{
	ll n, k, distance = 0;
	cin >> n >> k;
	// friends[i] = {친구의 위치, 친구가 가지고 있는 돈}
	vector<pair<ll, ll> > friends(n);
	for (int i = 0; i < n; i++)
	{
		cin >> friends[i].first >> friends[i].second;
	}
	sort(friends.begin(), friends.end());
	ll prevFriend = 0;
	for (int i = 0; i < n; i++)
	{
		ll nextFriendDistance = friends[i].first - prevFriend;
		if (nextFriendDistance > k)
		{
			distance += k;
			k = 0;
			break;
		}
		else
		{
			distance += nextFriendDistance;
			k -= nextFriendDistance;
			k += friends[i].second;
			prevFriend = friends[i].first;
		}
	}
	distance += k;
	cout << distance << '\n';
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
typedef long long ll;

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a;
  a.push_back(0);
  a.push_back(n + 1);
  rep(i, m) {
    int temp;
    cin >> temp;
    a.push_back(temp);
  }
  sort(a.begin(), a.end());
  // 差分のminを計算
  vector<int> a_sub;
  rep(i, a.size() - 1) {
    int temp = a[i + 1] - a[i];
    if (temp == 1) continue;
    a_sub.push_back(temp);
  }
  if (a_sub.empty()) {
    cout << 0 << endl;
    return 0;
  }
  sort(a_sub.begin(), a_sub.end());
  int a_sub_min = a_sub[0] - 1;
  int count = 0;
  for (int c : a_sub) {
    count += (c - 2) / a_sub_min + 1;
  }
  cout << count << endl;
  return 0;
}