#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long s = 0;
  bool f = 0;
  char ch = ' ';
  while (!isdigit(ch)) {
    f |= (ch == '-');
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + (ch ^ 48);
    ch = getchar();
  }
  return (f) ? (-s) : (s);
}
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x < 10) {
    putchar(x + '0');
    return;
  }
  write(x / 10);
  putchar((x % 10) + '0');
  return;
}
const int N = 100005;
int n, Num, a[N];
struct Zidianshu {
  int Trie[N * 25][25], cnt;
  int End[N * 25];
  inline void Init() { cnt = 0; }
  inline void Insert(int Num) {
    int i, Root = 0;
    for (i = 0; i <= 23; i++) {
      int oo = (Num & (1 << i)) >> i;
      if (!Trie[Root][oo]) Trie[Root][oo] = ++cnt;
      Root = Trie[Root][oo];
    }
    End[Root]++;
  }
  inline int Query(int Num, int Want) {
    int i, Root = 0;
    for (i = 0; i <= 23; i++) {
      int oo = ((Want & (1 << i)) >> i) ^ ((Num & (1 << i)) >> i);
      if (!Trie[Root][oo]) return 0;
      Root = Trie[Root][oo];
    }
    return End[Root];
  }
} Trie;
int main() {
  Trie.Init();
  int i;
  long long ans = 0;
  n = read();
  Num = read();
  for (i = 1; i <= n; i++) {
    a[i] = read();
    ans += 1ll * Trie.Query(a[i], Num);
    Trie.Insert(a[i]);
  }
  write(ans), putchar('\n');
  return 0;
}
