#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pb push_back
#define ff first
#define ss second
#define YES printf("YES\n")
#define NO printf("NO\n")
#define nn "\n"
#define sci(x) scanf("%d", &x)
#define LL_INF (1LL << 62)
#define INF (1 << 30)
#define SetBit(x, k) (x |= (1LL << k))
#define ClearBit(x, k) (x &= ~(1LL << k))
#define CheckBit(x, k) (x & (1LL << k))
#define mod 1000000007 
#define N 100005


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, m;
    cin >> n >> m;
    int x[m+2];
    x[0] = 0;
    x[1] = n+1;
    for(int i = 2; i < m+2; i++){
        cin >> x[i];
    }

    sort(x, x+(m+2));

    int z = INF;
    for(int i = 1; i < m+2; i++){
        int diff = x[i]-x[i-1]-1;
        if(diff) z = min(z, diff);
    }

    ll ans = 0;
    for(int i = 1; i < m+2; i++){
        int diff = x[i]-x[i-1]-1;
        ans += (diff + z - 1)/z;
    }

    cout << ans << nn;
 
    return 0;
}
 

// Pratiyush Mishra

#include <bits/stdc++.h>
#define ull unsigned long long int
#define ll long long int
#define LL_MAX 9223372036854775807
#define pb push_back
#define pf push_front
#define mp make_pair
#define popb pop_back
#define vl vector<ll>
#define pl pair<ll,ll>
#define bs(v, x) binary_search(v.begin(), v.end(), x)
#define mem1(a) memset(a, -1, sizeof(a))
#define popf pop_front
#define p0(x) cout << x << " "
#define p1(x) cout << x << '\n'
#define p2(x, y) cout << x << " " << y << '\n'
#define p3(x, y, z) cout << x << " " << y << " " << z << '\n'
#define printv(v)                   \
  for (ll i = 0; i < v.size(); ++i) \
    cout << v[i] << " ";            \
  cout << '\n'
#define pr1(x) cout << fixed << setprecision(15) << x << '\n'
#define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val)  no. of elements strictly less than val
// s.find_by_order(i)  itertor to ith element (0 indexed)
#define mod 1000000007
#define mod1 998244353
#define fio                         \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL)
#define get(n) \
  ll n;        \
  cin >> n
#define getvec(v, n)         \
  vector<ll> v(n);           \
  for (ll i = 0; i < n; i++) \
    cin >> v[i];
#define getstr(s) \
  string s;       \
  cin >> s
#define all(x) x.begin(), x.end()
#define countBits(x) __builtin_popcount(x)
using namespace std;

ll n, m;
vl a, b;
vector<vl> dp;

ll solve(ll i, ll j)
{
  if (i >= n)
    return m - j;
  if (j >= m)
    return n - i;
  if (dp[i][j] != -1)
    return dp[i][j];
  ll ans1 = (a[i] != b[j]) + solve(i + 1, j + 1);
  ll ans2 = solve(i + 1, j) + 1;
  ll ans3 = solve(i, j + 1) + 1;
  ll ans = min(ans1, min(ans2, ans3));
  dp[i][j] = ans;
  return ans;
}

void mainSolve()
{
  cin >> n >> m;
  dp.resize(n, vl(m, -1));
  for (int i = 0; i < n; i++)
  {
    get(x);
    a.pb(x);
  }
  for (int i = 0; i < m; i++)
  {
    get(x);
    b.pb(x);
  }
  ll ans = solve(0, 0);
  p1(ans);
}

int main()
{
  fio;
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
  //get(t);
  ll t = 1;
  while (t--)
  {
    mainSolve();
  }
  return 0;
}
