#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() { int N, K; std::cin >> N >> K; std::vector arr(N, 0); long sum = 0; int haha = 0; int total = 0; bool last = false; for (int i = 0; i < N; i++) { std::cin >> arr[i]; } for (int start = 0; start < N; start++) { sum = 0; haha = 0; last = false; for (int end = start; end < N; end++) { sum += arr[end]; haha = haha | arr[end]; if (K == haha && sum >= K) { total++; last = true; } else if (last) { break; } } } std::cout << total << "\n"; return 0; }