/*
    ID:chenjiong
    PROG:barn1
    LANG:C++
*/

#include <stdio.h>
#include <string.h>
#include <algorithm>

using namespace std;

const int MAXN = 205;

int M,S,C;
int p[MAXN];
int l[MAXN];

bool cmp(const int& x,const int& y)
{
    return x > y;
}

int main()
{
    freopen("barn1.in","r",stdin);
    freopen("barn1.out","w",stdout);

    int i;
    
    scanf("%d%d%d",&M,&S,&C);
    for (i = 0; i < C; i++)
        scanf("%d",&p[i]);
    sort(p,p + C);

    for (i = 0; i < C - 1; i++)
        l[i] = p[i + 1] - p[i] - 1;
    sort(l,l + C - 1,cmp);

    int sum = 0;
    for (i = 0; i < M - 1; i++)
        sum += l[i];

    printf("%d\n",p[C - 1] - p[0] + 1 - sum);

    return 0;
}

 

posted on 2012-10-18 22:42  Sinker  阅读(143)  评论(0编辑  收藏  举报