#include <bits/stdc++.h>
using namespace std;
const int N=20000+5;
const int M=100+5;
int l,n,ans=0;
int x[M];
int main(){
freopen ("device.in","r",stdin);
freopen ("device.out","w",stdout);
scanf("%d%d",&n,&l);l*=2;
for (int i=1;i<=n;i++){
scanf("%d",&x[i]);x[i]*=2;
}
sort(x+1,x+n+1);
for (int i=1;i<=l;i++){
int a=0,b=0,ok=0;
for (int j=1;x[j]<i;j++)a=j;
for (int j=n;x[j]>i;j--)b=j;
if (a==0||b==0)continue;
while(a>=1&&b<=n){
if (x[a]+x[b]!=2*i){
ok=1;break;
}
a--;b++;
}
if (ok==0)ans++;
}
printf("%d\n",ans);
return 0;
}