#include<bits/stdc++.h>
using namespace std;
int n, l, a[30010], ans = 0;
int main() {
freopen("device.in", "r", stdin);
freopen("device.out", "w", stdout);
cin >> n >> l;
l *= 2;
for(int i = 1; i <= n; i ++) {
int x;
cin >> x;
x *= 2;
a[x] = 1;
}
for(int i = 1; i < l; i ++) {
int f = 1;
for(int j = 0; i + j <= l && i >= j; j ++) {
if(a[i - j] != a[i + j]) {
f = 0;
break;
}
}
if(f == 1) {
ans ++;
}
}
cout << ans << endl;
return 0;
}