#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 52;
const int M = 1000;
int len, n,i;
int a[N];
int dp[N][N];
int min(int a, int b){
if (a < b){
return a; //假如a<b,返回a
}
else{return b; //否则返回b
}
}
int main(void)
{
while (scanf("%d", &len) && len) {
scanf("%d", &n);
for (i = 1; i <= n; i++)
scanf("%d", &a[i]);
a[0] = 0;
a[n+1] = len;
memset(dp, 0, sizeof(dp));
for (i = 2; i <= n+1; i++) {
for (int j = 0; j <= n+1-i; j++) {
dp[i][j] = M*N;
for (int k = 1; k <= i-1; k++)
dp[i][j] = min(dp[i][j], dp[k][j]+dp[i-k][j+k]+a[j+i]-a[j]);
}
}
printf("The minimum cutting is %d.\n", dp[n+1][0]);
}
return 0;
}