output_description: Find the minimum number of moves required to achieve the objective.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      X_1 X_2 ... X_M
attempt: #include <iostream>
  #include <algorithm>
  #include <utility>
  #include <set>
  #include <vector>
  #include <map>
  #include <queue>
  #include <list>
  #include <stack>
  #include <string>
  #include <cmath>
  
  using namespace std;
  
  typedef pair<int, int> pi;
  typedef vector<int> vi;
  typedef vector<pi> vpi;
  typedef long long ll;
  typedef vector<ll> vl;
  typedef pair<ll, ll> pl;
  typedef double db;
  typedef string str;
  typedef vector<str> vs;
  
  #define in(x) cin >> x
  #define ini(x) int x; cin >> x
  #define inl(x) ll x; cin >> x
  #define ins(x) str s; cin >> x
  
  #define out(x) cout << x
  #define outb(x) cout << x << ' '
  #define outn(x) cout << x << '\n'
  
  #define mp make_pair
  #define fi first
  #define se second
  #define pb push_back
  #define sz size()
  #define len length()
  #define all(x) x.begin(), x.end()
  #define alln(a, n) a, a+n 
  
  #define forn(i, s, e) for (int i = s; i < e; i++)
  #define forr(i, s, e) for (int i = s; i >= e; i--)
  #define ford(i, s, e, d) for (int i = s; i < e; i += d)
  #define fors(i, n) for (int i = 1; i*i <= n; i++)
  
  const int MAX = (int)1e5 + 9;
  
  int arr[MAX];
  
  int main() {
  	ios::sync_with_stdio(false);
  	cin.tie(NULL); cout.tie(NULL);
  
  	ini(n); ini(m);
  	forn(i, 0, m) in(arr[i]);
  	sort(alln(arr, m));
  	int md = arr[m-1] - arr[0];
  	vi d;
  	forn(i, 1, m) d.pb(arr[i] - arr[i-1]);
  	sort(all(d));
  	reverse(all(d));
  	forn(i, 0, n-1) md -= d[i];
  	outn(md);
  		
  	return 0;
  }
  
problem_description: Statement
  
  We will play a one-player game using a number line and N pieces.
  
  First, we place each of these pieces at some integer coordinate.
  
  Here, multiple pieces can be placed at the same coordinate.
  
  Our objective is to visit all of the M coordinates X_1, X_2, ..., X_M with
  these pieces, by repeating the following move:
  
  **Move** : Choose a piece and let x be its coordinate. Put that piece at
  coordinate x+1 or x-1.
  
  Note that the coordinates where we initially place the pieces are already
  regarded as visited.
  
  Find the minimum number of moves required to achieve the objective.
samples: [{"input": "2 5\n    10 12 1 2 14", "output": "5\n    \n\nThe objective can be achieved in five moves as follows, and this is the\nminimum number of moves required.\n\n  * Initially, put the two pieces at coordinates 1 and 10.\n  * Move the piece at coordinate 1 to 2.\n  * Move the piece at coordinate 10 to 11.\n  * Move the piece at coordinate 11 to 12.\n  * Move the piece at coordinate 12 to 13.\n  * Move the piece at coordinate 13 to 14.\n\n* * *"}, {"input": "3 7\n    -10 -3 0 9 -100 2 17", "output": "19\n    \n\n* * *"}, {"input": "100 1\n    -100000", "output": "0"}]