#include using namespace std; using ll = long long; #define F first #define S second #define all(x) (x).begin(), (x).end() #define rall(x) (x).rbegin(), (x).rend() #define sz(x) (int)(x).size() #define int long long const int MAXN = 4 * 1e5 + 1; int tree[4 * MAXN]; int f(int a, int b) { return a | b; } void update(int v, int tl, int tr, int pos, int val) { if (tl == tr) { tree[v] = val; return; } int tm = (tl + tr) / 2; if (pos <= tm) update(v * 2, tl, tm, pos, val); else update(v * 2 + 1, tm + 1, tr, pos, val); tree[v] = f(tree[v * 2], tree[v * 2 + 1]); } int get(int v, int tl, int tr, int l, int r) { if (l > r) return 0; if (tl == l && tr == r) return tree[v]; int tm = (tl + tr) / 2; return f(get(v * 2, tl, tm, l, min(tm, r)), get(v * 2 + 1, tm + 1, tr, max(l, tm + 1), r)); } void solve() { int n, k; cin >> n >> k; int ans = 0; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; update(1, 0, n - 1, i, a[i]); } for (int i = 0; i < n; i++) { int l = -1, r = i + 1; while (l + 1 < r) { int mid = (l + r) / 2; if (get(1, 0, n - 1, mid, i) > k) l = mid; else r = mid; } int left_bound = r; l = -1, r = i + 1; while (l + 1 < r) { int mid = (l + r) / 2; if (get(1, 0, n - 1, mid, i) >= k) l = mid; else r = mid; } int right_bound = l; if (left_bound <= right_bound) { ans += right_bound - left_bound + 1; } } cout << ans << endl; } signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); solve(); return 0; }