jiahuimbzuai/CoQuIR huggingface dataset:
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin', 'utf8').split(/[\s]/);const nin=()=>{const r = input[0];input.shift();return Number(r)};const nrin=(n)=>{const a:number[]=[];rep(n,()=>a.push(nin()));return a};const sin=()=>{const r = input[0];input.shift();return String(r)};const out=(...a)=>{console.log(...a)};const floor=(a)=>{return Math.floor(a)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const rep=(n, callback)=>{for(let i = 0;i < n; i++){callback()}};const strrep=(s, i, v)=>{return s.slice(0, i)+v+s.slice(i+1);};const permutation=({result=[],pre=[],post,n=post.length})=>{if(n>0){post.forEach((_,i)=>{const rest=[...post];const elem=rest.splice(i, 1);permutation({result, pre: [...pre,...elem],post:rest,n:n-1})})}else{result.push(pre)}return result};const sw=(s,a:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<a.length;i+=2){if(op==='=='){if(s==a[i])return a[i+1]}else if(op==='>='){if(s>=a[i])return a[i+1]}else if(op==='<='){if(s<=a[i])return a[i+1]}else if(op==='>'){if(s>a[i])return a[i+1]}else if(op==='<'){if(s<a[i])return a[i+1]}}return a[a.length-1];};const or=(a,...b)=>{for(let i=0;i<b.length;i++)if(a==b[i])return true;return false};const maxindex=(...a)=>{return a.indexOf(Math.max.apply(null,a))};const asc=(ar:number[])=>{return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{return ar.sort((a,b)=>{return b-a})};const ceil=a=>{return Math.ceil(a)};const srin=s=>{const a:string[]=[];rep(s,()=>a.push(sin()));return a};let ssinteger=-1;const ssin=()=>{ssinteger++;return input[0][ssinteger]};
const main = ()=>{
  let n=nin()
  out(n*800-floor(n/15)*200)
}
main()
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const N = parseInt(input[0], 10);
  const x = N*800;
  const y = Math.floor(N/15)*200;
  
  console.log(x-y);
  
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const N = Number(input[0][0]);

  const x = N * 800;
  const y = Math.floor(N / 15) * 200;

  return x - y;
};

console.log(main(read()));
//  [typescript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10));
   let N = xs[0];
   let num = Math.floor(N/15)*200;
   console.log(N*800-num);
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [typescript]
import * as fs from 'fs';

const n: number = +fs.readFileSync('/dev/stdin', 'utf8').trim();
console.log(n * 800 - (Math.floor(n / 15)*200));
//  [python]
# encoding:utf-8

import copy
import numpy as np
import random


n,k = map(int,input().split())

if 2*k <= n+1:
    answer = "YES"
else:
    answer = "NO"

print(answer)
//  [python]
import numpy as np


# x=1,y=2
N,K = map(int,input().split())

if N+1<K*2:
    print("NO")
else:
    print("YES")
//  [python]
import numpy as np
n,k = list(map(int, input().split()))

if n%2 == 0:
    if (n//2) >= k:
        print('YES')
    else:
        print('NO')
else:
    if (n//2 + 1) >= k:
        print('YES')
    else:
        print('NO')
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        System.out.println((n >= k * 2 - 1) ? "YES" : "NO");
    }
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long L = sc.nextLong();
        sc.close();
        System.out.println(L * 2 - 1 > N ? "NO" : "YES");
    }
}
//  [java]
import java.util.Scanner;
public class Main {
	public static void main(String[] args) throws Exception{
		Scanner stdIn=new Scanner(System.in);
		int N=stdIn.nextInt();
		int K=stdIn.nextInt();
		if(N%2==0){
			if(K<=N/2)
				System.out.println("YES");
			else
				System.out.println("NO");
		}
		else
			if(K<=(N/2)+1)
				System.out.println("YES");
			else
				System.out.println("NO");
	}
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    if((n+1)/2>=k)
    {
        cout<<"YES"<<endl;
    }
    else
    {
        cout<<"NO"<<endl;
    }
    return 0;
}
//  [cpp]
#include <bits/stdc++.h>

using namespace std;

const int MOD = 1e9 + 21;

void solve()
{

}

int main()
{
    ios_base :: sync_with_stdio(false);
    cin.tie(NULL);
//    freopen("input.txt", "r", stdin);

    int n, k;
    cin >> n >> k;

    n -= n / 2;
    if(n >= k)
        cout << "YES\n";
    else
        cout << "NO\n";

    return 0;
}
//  [cpp]
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){


 
  
  ll n,k;
  cin>>n>>k;
   if(  (n+1) / 2 >= k )
   cout<<"YES\n";
   else
   cout<<"NO\n";
    
  


return 0;

}






int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}
//  [c]
#include <stdio.h>

int main(void) {
	int N, K;
	if (scanf("%d%d", &N, &K) != 2) return 1;
	puts((N - 1) / 2 >= K - 1 ? "YES" : "NO");
	return 0;
}
//  [c]
#include <stdio.h>

int main(){
  int N,K;
  scanf("%d %d",&N,&K);
  
  if(N>=2*K-1) printf("YES\n");
  else printf("NO\n");
  return 0;
}
//  [c]
#include<stdio.h>

int main(void){
int N,K,c,i;
scanf("%d %d",&N,&K);
c=0;
i=1;
do{
 c++;
 if(c>=K){break;}
 i+=2;
}while(i<=N);
if(c>=K){printf("YES\n");}else{printf("NO\n");}
return 0;
}
//  [javascript]
'use strict'

const main = (INPUT) => {
  const N = Number(INPUT.split('\n')[0].split(' ')[0])
  const K = Number(INPUT.split('\n')[0].split(' ')[1])

  let cnt = 0
  for (let i = 1; i <= N; i += 2) {
    cnt++
  }
  if (cnt >= K) {
    console.log('YES')
  } else {
    console.log('NO')
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))
//  [javascript]
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  return (n+1)/2 >= k ? "YES":"NO";
}
//  [javascript]
function Main(input) {
	input = input.split(' ');
	var N=parseInt(input[0]);
        var K=parseInt(input[1]);
	var kanou=(!(N+1<2*K));
	console.log((kanou)?'YES':'NO');
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main
 
import (
  "fmt"
)
 
func main() {
  var n, k int
  fmt.Scanf("%d %d", &n, &k)
  
  ans := "NO"
  if (n+1)/2 >= k {
    ans = "YES"
  }
  fmt.Printf("%s\n", ans)
}
//  [go]
package main

import (
	"fmt"
	"math"
)

func main() {
	// Code for A - Anti-Adjacency
	var N, K int
	fmt.Scanf("%d %d", &N, &K)

	if int(math.Ceil(float64(N)/2)) >= K {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}
//  [ruby]
n,k = gets.chomp.split(' ').map(&:to_i)
if (2*k-1) <= n
  puts 'YES'
else
  puts 'NO'
end
//  [ruby]
n, k = gets.chomp.split.map(&:to_i)
puts (n/2.0).ceil >= k ? "YES" : "NO"
//  [ruby]
n,k = gets.split.map &:to_i
 
if -1 + 2 * k <= n
    puts "YES"
else
    puts "NO"
end
//  [rust]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use itertools::Itertools;
use proconio::*;
use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let k: usize = read!();

    println!("{}", if (n+1) / 2 >= k { "YES" } else { "NO" });
}
//  [rust]
fn main() {
    proconio::input! {
    a:[usize;2],
    }
    println!("{}",if (a[0]+1)/2>=a[1]{"YES"}else{"NO"})
}
//  [typescript]
export class Main {
  static main(input: string): string {
    const [n, k] = input.split("\n")[0].split(" ").map(Number);
    return k <= Math.ceil(n/2) ? "YES" : "NO";
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));
//  [python]
#!/usr/bin/env python3
# vim: set fileencoding=utf-8

# pylint: disable=unused-import, invalid-name, missing-docstring, bad-continuation


"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple


def solve(s: str, t: str) -> bool:
    if len(t) != len(s) + 1:
        return False
    return t[: len(s)] == s


def do_job():
    "Do the work"
    LOG.debug("Start working")
    # first line is number of test cases
    S = input()
    T = input()
    result = solve(S, T)
    print("Yes" if result else "No")


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case #{}: {}".format(testcase + 1, result))
    # 6 digits float precision {:.6f} (6 is the default value)
    # print("Case #{}: {:f}".format(testcase + 1, result))


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None
# for interactive call: do not add multiple times the handler
if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            # uncachable -- for instance, passing a list as an argument.
            # Better to not cache than to blow up entirely.
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)
//  [python]
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub


import sys
# sys.setrecursionlimit(10**6)
buff_readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 2**62-1


def read_int():
    return int(buff_readline())


def read_int_n():
    return list(map(int, buff_readline().split()))


def read_float():
    return float(buff_readline())


def read_float_n():
    return list(map(float, buff_readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()

def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S, T):
    if S == T[:-1]:
        return 'Yes'
    return 'No'


def main():
    S = read_str()
    T = read_str()
    print(slv(S, T))


if __name__ == '__main__':
    main()
//  [java]
import java.util.*;
class Main
{
  public static void main(String[] args)
  {
    Scanner sc = new Scanner(System.in);
    
    String s = sc.next();
    String s1 = sc.next();
    int n = s.length();
    
    if (s1.substring(0,n ).equals(s)) {
      System.out.println("Yes");
    } else {
      System.out.println("No");
    }
  }
}
//  [java]
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        String T = sc.next();
        if(S.length() + 1 != T.length()) {
            System.out.println("No");
            return;
        }
        for(int i=0; i<S.length(); i++) {
            if(S.charAt(i) != T.charAt(i)) {
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>


int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
//    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

int compare_string(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
}
//  qsort(names, 3, sizeof *names, compare_string);

//long long  factorial(long long n) {
//    if (n > 0) {
//        return n * factorial(n - 1);
//    } else {
//        return 1;
//    }
//}
long long  factorial(long long n, long long depth) {
    if (n > 1) {
        depth++;
        return factorial(n / 2, depth);
    } else {
        return depth;
    }
}

int min(int a, int b) {
    if (a > b)
        return b;
    else
        return a;
}

int distance(int a, int b) {
  return abs(a-b)*abs(a-b);
}



//int ()
/*
int triangle(int a, int b, int c){
  if(a<b+c){
    if(b<c+a){
      if(c<a+b){
        printf("1\n");
        return 1;
      }
    }
  }
  printf("1\n");
  return 0;
}
*/

int main()
{
//  int  a, b, c, d, e, X, Y ,r;
  unsigned long long a, b, c, d, e, X, Y;
  //  double  c;
// long long  A[200003]={};
  int  A[200003]={};
  int  B[100003]={};
//  int  C[100003][100001]={};
  int  C[100003]={};

  int  flg=0;

//  char s[101][101]={};
  char s[10000001]={};
  char t[100001]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p=0,q=0;
  int sosuu[46] ={2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199};
  int min =100000001;
  int len=0;
  int l=0;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long  ans=0;
  int ans_ac=0;
  int ans_wa=0;
  int max=0;
  long long sum=0;
  int addr=0;
  int ptn=0;
  int  tmp=0;
  double per=0; 
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  b=100;
  //  a=0;
  scanf("%s", &s);
  scanf("%s", &t);
//        printf("%s\n",s);
  len=strlen(s);
//          printf("%d\n",len);

    if( strncmp(s,t,len)!=0){
      printf("No\n");
    }
  else printf("Yes\n");
return 0;
}
//  [c]
#include<string.h>
#include<stdio.h>
int main()
{
  char s[11],t[12];
  scanf("%s%s",s,t);
  int f=1;
  int n=strlen(s);
  for(int i=0;i<n;++i)
  {
    if(s[i]!=t[i])
    {f=0;break;}
  }
  if(f)
    printf("Yes");
  else
    printf("No");
  return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>
int main(){

    char s[12], t[12];
    scanf("%s", s);
    scanf("%s", t);


    int length = strlen(s), i;

    for (i=0; i<length; ++i){
        if(s[i]!=t[i]){
            printf("No");
            return 0;
        }
    }

    if(length+1==strlen(t)){
        printf("Yes\n");
    }else{
        printf("No\n");
    }

    return 0;
}
//  [javascript]
function Main(input){
    const lines = input.trim().split("\n");
    const s = lines[0];
    const t = lines[1];

    if (s === t.substring(0, t.length - 1)) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

function main(input) {
  const inputList = input.split('\n');
  const s = inputList[0]
  const t = inputList[1]

  if (s.length+1 === t.length && s === t.slice(0, t.length-1)) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function Main(input) {
  input = input.split("\n");
  if (input[0] + input[1].slice(-1) === input[1]) {
    console.log("Yes");
  } else {
    console.log("No");
  }
    
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main

import (
	"fmt"
)

var (
	finv, inv, fac [MAX]int
)

func COM(n, k int) int {
	if n < k {
		return 0
	}
	if n < 0 || k < 0 {
		return 0
	}
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD
}

func init() {
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i := 2; i < MAX; i++ {
		fac[i] = fac[i-1] * i % MOD
		inv[i] = MOD - inv[MOD%i]*(MOD/i)%MOD
		finv[i] = finv[i-1] * inv[i] % MOD
	}
}

const (
	MOD = 1000000007
	MAX = 510000
)

func ModAdd(a, b int64) int64 {
	return (a + b) % MOD
}

func ModMul(a, b int64) int64 {
	return a * b % MOD
}

func ModSub(a, b int64) int64 {
	r := (a%MOD - b%MOD) % MOD
	if r < 0 {
		r += MOD
	}
	return r
}

func ModDiv(a, b int64) int64 {
	return a % MOD * ModInv(b) % MOD
}

func ModPow(a, n int64) int64 {
	var r int64 = 1
	for n > 0 {
		if n&1 == 1 {
			r = r * a % MOD
		}
		a = a * a % MOD
		n >>= 1
	}
	return r
}

func ModInv(a int64) int64 {
	var b, u, v int64 = MOD, 1, 0
	for b > 0 {
		t := a / b
		a -= t * b
		a, b = b, a
		u -= t * v
		u, v = v, u
	}
	u %= MOD
	if u < 0 {
		u += MOD
	}
	return u
}

type Q struct {
	value int
	index int
	A, B  int
}

type QS []*Q

func (p QS) Len() int           { return len(p) }
func (p QS) Less(i, j int) bool { return p[i].value > p[j].value }
func (pq QS) Swap(i, j int) {
	pq[i], pq[j] = pq[j], pq[i]
	pq[i].index = i
	pq[j].index = j
}

func (pq *QS) Push(x interface{}) {
	n := len(*pq)
	item := x.(*Q)
	item.index = n
	*pq = append(*pq, item)
}

func (pq *QS) Pop() interface{} {
	old := *pq
	n := len(old)
	item := old[n-1]
	old[n-1] = nil  // avoid memory leak
	item.index = -1 // for safety
	*pq = old[0 : n-1]
	return item
}

func FactoredPrimeNumber(num int) map[int]int {
	m := map[int]int{}
	return factor(m, num, 2)
}

func factor(result map[int]int, num, pnum int) map[int]int {
	if pnum*pnum > num {
		if num != 1 {
			result[num] += 1
		}
		return result
	}

	if num%pnum == 0 {
		num /= pnum
		result[pnum]++
	} else {
		pnum++
	}
	return factor(result, num, pnum)
}

func GCD(a, b int64) int64 {
	if b == 0 {
		return a
	}
	return GCD(b, a%b)
}

func LCM(a, b int64) int64 {
	return a * b / GCD(a, b)
}

func main() {
	var S, T string
	fmt.Scanf("%s\n%s\n", &S, &T)

	if string([]rune(S)) == string([]rune(T)[:len(S)]) {
		fmt.Println("Yes")

	} else {
		fmt.Println("No")

	}

}

func Reverse(runes []rune) []rune {
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return runes
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	sc := NewScanner()

	s := sc.ReadString()
	t := sc.ReadString()

	for i := 0; i < len(s); i++ {
		if t[i] != s[i] {
			fmt.Println("No")
			return
		}
	}

	fmt.Println("Yes")
}

// util
// *   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}
	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base int, exponent uint) int {
	answer := 1
	for i := uint(0); i < exponent; i++ {
		answer *= base
	}
	return answer
}

// *   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// *   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}
//  [go]
package main

import "fmt"

func main() {
	var S, T string
	fmt.Scan(&S, &T)
	for i, v := range S {
		if T[i] != byte(v) {
			fmt.Println("No")
			return
		}
	}
	fmt.Println("Yes")
}
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
s = gets.chomp
t = gets.chomp

t = t.slice(0, t.size-1)
if s == t
  puts 'Yes'
else
  puts 'No'
end
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}


# 入力値を文字の配列で返却する
def gets_nsp_list()
  gets.chomp.split("")
end

s_list = gets_nsp_list
t_list = gets_nsp_list

s_list.each_with_index do |c, i|
  unless c == t_list[i]
    puts "No"
    exit
  end
end
puts "Yes"
//  [ruby]
require 'pp'

n = gets.chomp!.chars
t = gets.chomp!.chars

if n.length + 1 != t.length 
    puts "No"
    exit 0
end

ok = true
n.each_with_index do |ch, i|
    if ch != t[i]
        puts "No"
        exit 0
    end
end

puts "Yes"
//  [swift]
import Foundation

let s = readLine()!
let t = readLine()!

if t.count - s.count != 1 {
    print("No")
    exit(0)
}

if t.hasPrefix(s) {
    print("Yes")
} else {
    print("No")
}
//  [swift]
let s = cin.str
let t = cin.str

if s.allSatisfy({ $0.isLowercase }), 
    t.allSatisfy({ $0.isLowercase }),
    s.count <= 10,
    t.prefix(s.count) == s,
    t.count == s.count + 1 {
        print("Yes")
} else {
    print("No")
}

// MARK: #### 以下、ライブラリ ####

import Foundation
#if os(Linux)
    import Glibc
#else
    import Darwin.C
#endif

enum cin {
    // 123
    static var int: Int { Int(readLine()!)! }
    // 12 23
    static var pair: (Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!) }
    // 12 23 34
    static var triple: (Int, Int, Int) { let line = readLine()!.components(separatedBy: " "); return (Int(line[0])!, Int(line[1])!, Int(line[2])!) }
    // AtCoder
    static var str: String { readLine()! }
    // At Coder
    static var arrayStr: [String] { str.components(separatedBy: " ") }
    // 1 2 3 4
    static var array: [Int] { str.components(separatedBy: " ").map { Int($0)! } }
    // 1
    // 2
    // 3
    static func v_array(count: Int) -> [Int] { (0..<count).map { _ in int } }
}

extension Int {
    // 123 -> [1, 2, 3]
    var digits: [Int] { Array(String(self)).map { Int(String($0))! } }
}

extension Array where Element == Int {
    // [2, 1, 3, 2] -> 8
    var sum: Int { self.reduce(0, +) }
    // [2, 1, 3, 2] -> [1, 2, 2, 3]
    var orderBy: [Int] { sorted() }
    // [2, 1, 3, 2] -> [3, 2, 2, 1]
    var orderByDesc: [Int] { sorted(by: { $0 > $1 }) }
    // [2, 1, 3, 2] -> [2, 1, 3]
    var distinct: [Int] { Array(Set(self)) }
}

precedencegroup PowerPrecedence { higherThan: MultiplicationPrecedence }
infix operator ^^ : PowerPrecedence
func ^^ (radix: Int, power: Int) -> Int {
    return Int(pow(Double(radix), Double(power)))
}

extension String {
    // e.g. cin.line.regex(match: "^(dream|dreamer|erase|eraser)*$")
    func regex(match pattern: String) -> Bool {
        let regex = try! NSRegularExpression(pattern: pattern)
        return regex.firstMatch(in: self, range: NSRange(location: 0, length: self.count)) != nil
    }
    // "ABC"[1] -> "B"
    subscript(i: Int) -> Character {
        get {
            self[index(at: i)]
        }
        set(char) {
            var characters = Array(self)
            characters[i] = char
            self = String(characters)
        }
    }
    func index(at offset: Int) -> String.Index { index(startIndex, offsetBy: offset) }
    // "ABC".swapAt(0, 1) -> "BAC"
    mutating func swapAt(_ index1: Int, _ index2: Int) {
        var characters = Array(self)
        characters.swapAt(index1, index2)
        self = String(characters)
    }
}
//  [swift]
import Foundation

let s = readLine()!
let t = readLine()!

if t.hasPrefix(s) {
    print("Yes")
} else {
    print("No")
}
//  [typescript]
import { count } from 'console';

process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const s = inputs[0];
  const t = inputs[1];
  
  if (t.length === s.length + 1
      && s === t.substring(0,s.length)) {
        console.log('Yes');
        return;
  }
  console.log('No');
}
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const S = input[0][0];
  const T = input[1][0];

  return T.slice(0, -1) === S ? "Yes" : "No";
};

console.log(main(read()));
//  [python]
from sys import stdin
from numpy import empty

N, M = [int(x) for x in stdin.readline().rstrip().split()]
X = [int(x) for x in stdin.readline().rstrip().split()]

sortX = sorted(X)
dist = empty(M)

for i in range(M-1):
    dist[i] = sortX[i+1] - sortX[i]

sortedDist = sorted(dist, reverse=True)
result = sum(sortedDist[N-1:M-1])
print(int(result))
//  [python]
import numpy as np
n,m=map(int,input().split())
x=list(map(int,input().split()))

arr=np.array(sorted(x))
dif=np.diff(arr)

lis=dif.tolist()
lis=sorted(lis,reverse=True)

for i in range(n-1):
    if len(lis)>0:
        lis.pop(0)

print(sum(lis))
//  [python]
import numpy as np

N, M = map(int, input().split())
X = list(map(int, input().split()))

if N >= M:
  print(0)
else:
  X.sort()
  npX = np.array(X)
  D = npX[1:] - npX[:-1]
  D.sort()
  print(sum(D[0:M-N]))
//  [java]
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		List<Integer> list = new ArrayList<>();
		List<Integer> subList = new ArrayList<>();

		for (int i = 0; i < m; i++) {
			int x = sc.nextInt();

			list.add(x);

		}
		if (n > m) {
			System.out.println(0);
			sc.close();
			return;
		}
		Collections.sort(list);

		for (int i = 0; i < m - 1; i++) {

			int low = list.get(i);
			int high = list.get(i + 1);

			int sub = high - low;

			subList.add(sub);

		}

		Collections.sort(subList);
		Collections.reverse(subList);

		for (int i = 0; i < n - 1; i++) {

			subList.remove(0);

		}
		int ans = subList.stream().mapToInt(Integer::valueOf).sum();

		System.out.println(ans);

		sc.close();
	}

}
//  [java]
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		List<Integer> list=new ArrayList<Integer>();
		//Long[] array = new Long[6];
		int n = sc.nextInt();
		int m = sc.nextInt();
		for(int i=0;m>i;i++) {
			int a = sc.nextInt();
			list.add(a);
		}
		List<Integer> list_sa=new ArrayList<Integer>();
		Collections.sort(list);
		for(int i=0;m-1>i;i++) {
			list_sa.add(list.get(i+1)-list.get(i));
		}
		Collections.sort(list_sa, Collections.reverseOrder());
		//System.out.println(list_sa);
		for(int i=0;n-1>i;i++) {
			if(list_sa.size()==0) {
				System.out.println(0);
				System.exit(0);
			}
			list_sa.remove(0);
		}
		int answer=0;
		for(int i=0;list_sa.size()>i;i++) {
			answer=answer+list_sa.get(i);
		}
		System.out.println(answer);
	}
}
//  [java]
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N =sc.nextInt();
        int M = sc.nextInt();
        ArrayList<Integer> List= new ArrayList<>();
        for(int a=0;a<M;a++)List.add(sc.nextInt());
        Collections.sort(List,Comparator.reverseOrder());
        ArrayList<Integer> dis_List = new ArrayList<>();
        for(int a=0;a<List.size()-1;a++){
            int dis = List.get(a)-List.get(a+1);
            dis_List.add(dis);
        }
        Collections.sort(dis_List,Comparator.reverseOrder());
        for(int a=0;a<N-1;a++)
        {
            if(dis_List.size()==0)break;
            dis_List.remove(0);
        }

        int sum=0;
        for(int a=0;a<dis_List.size();a++) sum+=dis_List.get(a);
        System.out.println(sum);
    }
}
//  [cpp]
#include <stdio.h>
#include <stdlib.h>

void Quicksort_rand(int A[], int L, int R);

int main(void)
{
	int i, N, M, X[100005];

	scanf("%d %d", &N, &M);
	for (i = 1; i <= M; i++)scanf("%d", &X[i]);

	if (N >= M) {
		printf("0");
		return 0;
	}

	Quicksort_rand(X, 1, M);
	int length, distance[100005];
	length = X[M] - X[1];
	for (i = 1; i < M; i++) {
		distance[i] = X[i+1] - X[i];
	}
	Quicksort_rand(distance, 1, M - 1);
	for (i = 0; i < N - 1; i++) {
		length -= distance[M-1-i];
	}
	printf("%d", length);


	return 0;
}

void Quicksort_rand(int A[], int L, int R)/*A[L]~A[R]までソート*/
{
	if (L < R)
	{
		int r, tmp, p = L, k = L + 1;

		srand(0);
		r = rand() % (R - L + 1) + L;//pivotを選択

		//pivotを先頭に置く
		tmp = A[L];
		A[L] = A[r];
		A[r] = tmp;

		//左の翼と右の翼に分ける
		while (k <= R) {
			if (A[k] < A[L]) {
				tmp = A[k];
				A[k] = A[p + 1];
				A[p + 1] = tmp;
				p++;
			}
			k++;
		}

		//pivotを左右の翼の境目に置く
		tmp = A[L];
		A[L] = A[p];
		A[p] = tmp;

		//左右の翼で再帰
		Quicksort_rand(A, L, p - 1);
		Quicksort_rand(A, p + 1, R);
	}
	return;
}
//  [cpp]
#include <iostream>
#include <cstdio>
#include<algorithm>
using namespace std;
 
void qst(int *x, int begin, int end)
{
    if (begin >= end) {
        return;
    }
    int pivot = x[end];
    int i = begin;
    int j = end;
    while (true) {
        for (;;++i){
            if (x[i] <= pivot) break;
        }
        for (;;--j) {
            if (i == j) {
                goto nextfunc;
            }
            if (x[j] > pivot) break;
        }
        int tmp = x[i];
        x[i] = x[j];
        x[j] = tmp;
    }
    nextfunc:
    x[end] = x[i];
    x[i] = pivot;
    qst(x, begin, i -1);
    qst(x, i + 1, end);
    return;
}
 
 
int main ()
{
    int n;
    int m;
    cin >> n >> m;
    int x[m];
    int sum = 0;
    for (int i = 0; i < m; ++i) {
        
        scanf("%i",&x[i]);
        
    }
    /*
    if (m == 1) {
        cout << 0;
        return 0;
    }
    */
    qst(x, 0, m - 1);
    sum = x[0] - x[m - 1];
    int dif[m - 1];
    for (int i = 0; i < m - 1;++i) {
        dif[i] = x[i] - x[i + 1];
    }
    qst(dif, 0 , m - 2);
    for (int i = 0; i < n - 1&& i < m - 1; ++i){
        sum -= dif[i];
    }
    cout << sum;
}
//  [cpp]
#include <iostream>
#include <vector>
#include <algorithm>


int main(){
   int N, M;
   std::cin >> N >> M;
   std::vector<int> X(M);
   for(int i=0; i<M; ++i)
      std::cin >> X[i];

   if(N>=M){
      std::cout << 0 << std::endl;
      return 0;
   }

   std::sort(X.begin(), X.end());
   std::vector<int> Y(N-1);
   for(int i=0; i<M-1; ++i){
      if(i<N-1) Y[i] = i;
      else{
	 int min = X[i+1]-X[i];
	 int index = -1;
	 for(int j=0; j<N-1; ++j){
	    if(min>X[Y[j]+1]-X[Y[j]]){
	       min = X[Y[j]+1] - X[Y[j]];
	       index = j;
	    }
	 }
	 if(index>-1){
	    Y[index] = i;
	 }
      }
   }

   int sum = X[M-1] - X[0];
   for(int i=0; i<N-1; ++i){
      sum -= X[Y[i]+1] - X[Y[i]];
   }
   std::cout << sum << std::endl;

   return 0;
}
//  [c]
#include<stdio.h>

int x[100001]={};
int diff[100001]={};
  
void q_sort(int numbers[], int left, int right)
{
  int pivot, l_hold, r_hold;

  l_hold = left;
  r_hold = right;
  pivot = numbers[left];
  while (left < right)
    {
      while ((numbers[right] >= pivot) && (left < right))
	right--;
      if (left != right)
	{
	  numbers[left] = numbers[right];
	  left++;
	}
      while ((numbers[left] <= pivot) && (left < right))
	left++;
      if (left != right)
	{
	  numbers[right] = numbers[left];
	  right--;
	}
    }
  numbers[left] = pivot;
  pivot = left;
  left = l_hold;
  right = r_hold;
  if (left < pivot)
    q_sort(numbers, left, pivot-1);
  if (right > pivot)
    q_sort(numbers, pivot+1, right);
}


int main()
{
  int n,m;
  int i;
  int ans = 0;
  
  scanf("%d %d", &n, &m);

  for (i = 0; i < m; i++) {
    scanf("%d", &x[i]);
  }

  q_sort(x, 0, m - 1);

  for (i = 0; i < m - 1; i++) {
    diff[i] = x[i + 1] - x[i];
  }

  q_sort(diff, 0, m - 2);

  for (i = 0; i < m - n; i++) {
    ans += diff[i];
  }

  printf("%d\n", ans);
  return 0;
}
//  [c]
#include <stdio.h>


int quick(int a[],int left,int right);
int swap(int* ,int* );                	

int main(void){
	int N,M;
	scanf("%d %d",&N,&M);
	
	int X[M],i;
	int min;
	for(i=0;i<M;i++){
	scanf("%d",&X[i]);
	}
	quick(X,0,M);

/*			for(i=0;i<M;i++){
				printf("%d ",X[i]);
		}
*/
	//N<Mを考える
	if(N<M){
		int sa[M-1];
		for(i=0;i<M-1;i++){
			sa[i]=X[i+1]-X[i];
			}
		quick(sa,0,M-1);
/*					printf("\n");
					for(i=0;i<M-1;i++){
					printf("%d ",sa[i]);
					}
*/
		min=0;
		for(i=0;i<M-N;i++){
			min+=sa[i];
		}
		printf("%d",min);
	} else printf("0");
	
		return 0;
}

int quick(int a[],int left, int right){	//クイックソート関数
	if(right-left<=1) return 0;
	
	/*printf("\n");
	for(int n=0;n<10;n++){  		//確認用
				printf("%d ",a[n]);
	}*/
				
	
	int j,pivot,pivot_index;
	//i:pivot未満を左詰めで格納 j:左から走査 pivot:適当な要素
	
	pivot_index=(left+right)/2;
	pivot=a[pivot_index];
	swap(&a[pivot_index],&a[right-1]);		//pivot=5,N-10  3,6,5,9,23,5,6,1,0,7
	
	
	int i=left; 
	for(j=left;j<right-1;++j){
		if (a[j]<pivot){
			swap(&a[j],&a[i++]);
				
		}
	}
			swap(&a[i],&a[right-1]);
	
	    quick(a,left,i);
		quick(a,i+1,right);
		
	return 0;
	
}

int swap(int *a,int *b){
	int tmp;
	tmp=*a;
	*a=*b;
	*b=tmp;
	return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

void q_sort(int numbers[], int left, int right)
{
    int pivot, l_hold, r_hold;

    l_hold = left;
    r_hold = right;
    pivot = numbers[left];
    while (left < right)
    {
        while ((numbers[right] >= pivot) && (left < right))
            right--;
        if (left != right)
        {
            numbers[left] = numbers[right];
            left++;
        }
        while ((numbers[left] <= pivot) && (left < right))
            left++;
        if (left != right)
        {
            numbers[right] = numbers[left];
            right--;
        }
    }
    numbers[left] = pivot;
    pivot = left;
    left = l_hold;
    right = r_hold;
    if (left < pivot)
        q_sort(numbers, left, pivot-1);
    if (right > pivot)
        q_sort(numbers, pivot+1, right);
}

int main(void){
    int n, m;
    scanf("%d %d", &n, &m);
    int x[m];
    for(int i = 0;i < m;i++){
        scanf("%d", &x[i]);
    }
    if(n >= m)printf("0\n");
    else{
        q_sort(x, 0, m-1);
        int y[m-1];
        for(int i = 0;i < m-1;i++){
            y[i] = x[i+1] - x[i]; 
        }
        q_sort(y, 0, m-2);
        int rem = m - n;
        int sum = 0;
        for(int i = 0;i < rem;i++){
            sum += y[i];
        }
        printf("%d\n", sum);
    }
    return 0;
}
//  [javascript]
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input,
  "index" : 0,
  "max" : input.length,
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  },
  "hasNext" : function(){return (this.index < this.max);}
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var M = one[1];
  var list = nextIntArray();
  list.sort(function(a,b){
  	return a - b;
  });
  var diff = new Array(M - 1);
  for(var i = 1; i < M; i++){
    diff[i - 1] = Math.abs(list[i - 1] - list[i]);
  }
  diff.sort(function(a,b){
  	return b - a;
  });
  myerr(diff);
  var output = 0;
  for(var i = N - 1; i < M - 1; i++){
    output += diff[i];
  }
  myout(output);
}
//  [go]
// 間を区切ってdifでソート
// 雑な方針で進めて途中でリファクタリングしながらしたんで最初からこの形がみえていたわけではない
package main
import (
	"fmt"
	"sort"
)
func main(){
	var K, N  int
	fmt.Scan(&K, &N)
	if K>=N{
		fmt.Println(0)
		return
	}
	A := make([]int, N)
	for i:=0; i<N; i++{
		fmt.Scan(&A[i])
	}
	sort.Ints(A)
	difs := make([][2]int, N-1)
	for i:=0; i<N-1; i++{
		difs[i] = [2]int{i, abs(A[i]-A[i+1])}
	}
	sort.Slice(difs, func(i, j int)bool{
		return  difs[i][1] > difs[j][1]
	})
	splits := make(map[int]bool)
	for _, dif := range difs[:K-1]{
		splits[dif[0]] = true
	}
	ans := 0
	for i:=0; i<N-1; i++{
		if !splits[i]{
			ans += A[i+1]-A[i]
		}
	}
	fmt.Println(ans)
}

func abs(x int)int{
	if x < 0{
		return x*-1
	}
	return x
}
//  [go]
package main

import (
	"fmt"
	"sort"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	xs := make([]int, m)
	for i := range xs {
		fmt.Scan(&xs[i])
	}

	if n >= m {
		fmt.Println(0)
		return
	}

	sort.Ints(xs)
	ls := make([]int, m-1)
	for i := 0; i < m-1; i++ {
		ls[i] = xs[i+1] - xs[i]
	}
	sort.Ints(ls)
	var sum int
	for i := 0; i < n-1; i++ {
		sum += ls[m-2-i]
	}

	fmt.Println(xs[m-1] - xs[0] - sum)
}
//  [ruby]
n, m = gets.split(" ").map(&:to_i)
xs = gets.split(" ").map(&:to_i)
xs.sort!

hoge = []

xs.each.with_index do |x,i|
  if i != 0
    hoge << {val: (x - xs[i-1]).abs, index: i}
  end
end

if hoge == []
  puts 0
  exit
end

hoge.sort!{|a,b| a[:val] <=> b[:val]}.reverse!
if n == 1
  puts (xs[0] - xs[-1]).abs
  exit
else
  use = hoge.take(n-1)
  inds = use.sort{|a,b| a[:val] <=> b[:val]}.map{|a| a[:index]}.sort
end

group = []
before = 0
inds.each do |i|
  current = xs[before...i]
  group << current
  before = i
end
group << xs[inds[-1]..-1]

count = group.reduce(0) do |a,e|
  a+=(e[0]-e[-1]).abs
end

puts count
//  [ruby]
n, m = gets.chomp.split(' ').map(&:to_i)
xs = gets.chomp.split(' ').map(&:to_i).sort
diffs = xs.each_cons(2).map.with_index{|a, i| {i: i + 1, d: (a[1] - a[0]).abs} }.sort{|a, b| b[:d] - a[:d] }
splitter = diffs.take(n - 1).map{|h| h[:i]}.sort
split_num = ([0] + splitter + [xs.length]).each_cons(2).map{|x| x[1] - x[0]}
splitted = split_num.map{|x| xs.shift(x)}
puts splitted.map{|a| a.last - a.first}.reduce(:+)
//  [ruby]
n, m = gets.chomp.split(' ').map(&:to_i)
xs = gets.chomp.split(' ').map(&:to_i)

if n >= m
  puts 0
elsif n == 1
  puts xs.max - xs.min
else
  xs = xs.sort
  ds = {}
  (m-1).times do |i|
    ds[i] = xs[i+1] - xs[i]
  end
  ds = ds.sort { |(k1, v1), (k2, v2)| v2 <=> v1 }
  ds = ds.slice(0, n-1).sort { |a, b| a[0] <=> b[0] }
  pre = 0
  res = 0
  n.times do |i|
    if i == 0
      res += xs.slice(pre..ds[i][0]).max - xs.slice(pre..ds[i][0]).min
      pre = ds[i][0]
    elsif i < n - 1
      res += xs.slice((pre + 1)..ds[i][0]).max - xs.slice((pre + 1)..ds[i][0]).min
      pre = ds[i][0]
    else
      res += xs.slice((pre + 1)..(xs.size - 1)).max - xs.slice((pre + 1)..(xs.size - 1)).min
    end
  end
  puts res
end
//  [rust]
fn solve() {
    let (n, m): (usize, usize) = (read::<usize>(), read::<usize>());
    let mut x: Vec<i64> = vec![];
    for i in 0..m {
        x.push(read());
    }
    x.sort();
    let mut int = vec![0; m - 1];
    //n-1個の区間を無視できる
    for i in 1..m {
        int[i - 1] = x[i] - x[i - 1];
    }
    int.sort();
    if n >= m {
        println!("{}", 0);
    } else {
        let mut res = 0;
        for i in 0..m - n {
            res += int[i];
        }
        println!("{}", res);
    }
}

fn main() {
    let stack_size = 104_857_600;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min, Reverse};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

#[allow(dead_code)]
const MOD: usize = 1000000007;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========
//  [rust]
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let m:usize = read();
    let mut v:Vec<i64> = (0..m).map(|_| read()).collect();
    v.sort();
    let mut diffs = Vec::new();
    for i in 1..m {
        diffs.push((v[i] - v[i-1]).abs());
    }
    diffs.sort_by(|a, b| b.cmp(a));
    let mut ans = v[m-1] - v[0];
    for i in 0..min(diffs.len(), n-1) {
        ans -= diffs[i];
    }
    println!("{}", ans);
}
//  [rust]
use std::cmp::min;
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let m:usize = read();
    let mut arr:Vec<i64> = (0..m).map(|_| read()).collect();
    arr.sort();

    let mut diffs = Vec::new();
    for i in 1..m {
        diffs.push(arr[i] - arr[i-1]);
    }
    diffs.sort_by(|a, b|b.cmp(a));

    let mut res = arr.get(m-1).unwrap() - arr[0];
    for i in 0..min(diffs.len(), n-1) {
        res -= diffs[i];
    }
    println!("{}", res);
}
//  [swift]
import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}

func main() {
    let nm = readWords { Int($0)! }
    let n = nm[0]
    let m = nm[1]
    
    if n >= m {
        print(0)
        return
    }

    let X = readWords { Int($0)! }.sorted()

    // 区間が得られる。
    // 問題を簡単にしてみる。
    // コマが1つなら答えは X[m-1] - X[0]
    // コマが複数あるなら、訪れない区間ができるのでそのうち一番広い区間を選択すれば良い。
    // コマが2つなら、訪れない区間は1つ。-> 全体から最も広い区間を1つ引く。
    // コマがn個なら、訪れない区間はn-1個。 -> 全体から広い区間をn-1個引く。

    var distances = (1..<m).map { X[$0] - X[$0-1] }
    distances.sort(by: >)

    print(distances.reduce(0, +) - distances[..<(n-1)].reduce(0, +))
}


main()
//  [swift]
import Foundation

class Scanner {
    static func readInt() -> Int {
        return Int(readLine()!)!
    }
    
    static func readIntArr() -> [Int] {
        return readLine()!.split(separator: " ").map { Int($0)! }
    }
    
    static func readM(_ n: Int) -> [[Int]] {
        var res = [[Int]]()
        for _ in 0..<n {
            res.append(readIntArr())
        }
        return res
    }
    
    static func readUknownIntMat() -> [[Int]] {
        var res = [[Int]]()
        while let line = readLine() {
            res.append(line.split(separator: " ").map { Int($0)! })
        }
        return res
    }
    
    static func readString() -> String {
        return readLine()!
    }
}

class Printer {
    static func printIntArray(_ arr: [Int]) {
        print(arr.map { String($0) }.joined(separator: " "))
    }
}


class Solution {
    
    func streamline(_ arr: [Int], _ n: Int) -> Int {
        guard n < arr.count else {
            return 0
        }
        /*
         n = 2, take first one
         */
        let arr = arr.sorted()
        var dist = [Int]()
        var res = 0
        for i in stride(from: 0, to: arr.count-1, by: 1) {
            dist.append(arr[i+1]-arr[i])
            res += dist.last!
        }
        dist.sort(by: { $0 > $1 })
        for i in stride(from: 0, to: n-1, by: 1) {
            res -= dist[i]
        }
        return res
    }
}


let nm = Scanner.readIntArr()
let arr = Scanner.readIntArr()
print(Solution().streamline(arr, nm[0]))
//  [python]
nums = list(map(int, input().split()))
print(len(set(nums)))
//  [python]
print(len(set(map(int, input().split()))))
//  [python]
print(len(set(input().split())))
//  [python]
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7


def main():
    a = input().split()
    s = set(a)
    return len(s)


print(main())
//  [python]
a, b, c = map(int, input().split())

print(len(set([a, b, c])))
//  [python]
a,b,c = map(int,input().split())
if a==b and b==c:
    print(1)
elif a==b or b==c or a==c:
    print(2)
else:
    print(3)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        try {
            // 標準入力
            InputStreamReader isr = new InputStreamReader(System.in);
            BufferedReader br = new BufferedReader(isr);
            String strArr[] = br.readLine().split(" ");
            int a = Integer.parseInt(strArr[0]);
            int b = Integer.parseInt(strArr[1]);
            int c = Integer.parseInt(strArr[2]);
            if (a == b) {
                if (a == c) {
                    System.out.println(1);
                } else {
                    System.out.println(2);
                }
            } else {
                if (a == c) {
                    System.out.println(2);
                } else if (b == c) {
                    System.out.println(2);
                } else {
                    System.out.println(3);
                }
            }
       } catch (IOException e) {
            e.printStackTrace();
       }
    }
}