#include <bits/stdc++.h>
const int N = 10010;
int n, l, ans;
int a[N];
bool valid(int t) {
int x = 0, y = 0;
for (int j = 1; a[j] < t; ++ j) x = j;
for (int j = n; a[j] > t; -- j) y = j;
while (x >= 1 && y <= n)
if (a[x --] + a[y ++] != 2 * t) return false;
return true;
}
int main() {
freopen("device.in", "r", stdin);
freopen("device.out", "w", stdout);
std::cin >> n >> l, l += l;
for (int i = 1; i <= n; ++ i)
std::cin >> a[i], a[i] += a[i];
std::sort(a + 1, a + 1 + n);
for (int i = 1; i <= l; ++ i)
ans += valid(i);
std::cout << ans << '\n';
return 0;
}