#include<bits/stdc++.h>
using namespace std;
const int maxn=1e7;
int p[maxn];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
long long k;
int n;
cin >> n >> k;
for(int i = 0; i < n; i++)
cin >> p[i];
long long minn = INT64_MAX;
for(int i = 0; i < n; ++i) {
for(int j = i+1; j < n; ++j) {
minn=min(minn,llabs(p[i] * p[j] - k));
}
}
cout << minn;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKY29uc3QgaW50IG1heG49MWU3OwppbnQgcFttYXhuXTsKCmludCBtYWluKCkgewogICAgaW9zOjpzeW5jX3dpdGhfc3RkaW8oMCk7CiAgICBjaW4udGllKDApOwoKICAgIGxvbmcgbG9uZyBrOwogICAgaW50IG47IAogICAgY2luID4+IG4gPj4gazsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyBpKyspIAogICAJY2luID4+IHBbaV07CiAgICBsb25nIGxvbmcgbWlubiA9IElOVDY0X01BWDsKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgICAgICBmb3IoaW50IGogPSBpKzE7IGogPCBuOyArK2opIHsKICAgICAgICAJCW1pbm49bWluKG1pbm4sbGxhYnMocFtpXSAqIHBbal0gLSBrKSk7CiAgICAgICAgICAgIAogICAgICAgIH0KICAgIH0KCiAgICBjb3V0IDw8IG1pbm47CgoKICAgIAogCiAKfQ==