#include using namespace std; int main() { int N, S; cin >> N >> S; vector A(N); for (int &a : A) cin >> a; auto m = [&](vector A) { vector V = {0}; for (int a : A) { vector W; int x = 1; while ((long)x * a <= S) { x *= a; for (int b : V) if (x + b <= S) W.push_back(x + b); } V = W; } return V; }; auto X = m(vector(A.begin(), A.begin() + N / 2)); auto Y = m(vector(A.begin() + N / 2, A.end())); sort(X.begin(), X.end()); sort(Y.begin(), Y.end()); long ans = 0; for(int x: X) ans += distance(Y.begin(), upper_bound(Y.begin(), Y.end(), S-x)); cout << ans << endl; return 0; }