#include #include #include #define DEBUG true #define $(x) {if (DEBUG) {std::cout << "(line " << __LINE__ << ") "; {x} std::cout << std::endl;}} #define _(x) {std::cout << #x << " = " << x << " ";} int main() { // $(_(N)); // $(_(M)); int N, K; std::cin >> N >> K; std::vector arr(N, 0); long sum = 0; int haha = 0; int total = 0; for (int i = 0; i < N; i++) { std::cin >> arr[i]; } for (int start = 0; start < N; start++) { sum = 0; haha = 0; for (int end = start; end < N; end++) { sum += arr[end]; haha = haha | arr[end]; if (K == (long)haha && sum >= K) { total++; } // std::cout << "start: " << start << ", end: " << end << ", sum: " << sum << ", or: " << haha << "\n"; // if (haha >= K && sum >= K) { // total++; // } } } std::cout << total << "\n"; return 0; }