#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char** argv) {
	int n,k,p[10],karta;
	cin >> n;
	cin >> k;
	for(int i = 1;i<=n;i++) {
		cin >> p[i];
		if(n<=2) {
			karta=k-p[i];
		}
	}
	cout << karta;
	return 0;
}