#include <bits/stdc++.h>
using namespace std;
int n;
const long long mod = 1e9 + 7;
long long k;
long long a[101];
typedef struct M {
  long long m[111][111];
} matrix;
matrix ans, ret;
matrix multi(matrix x, matrix y) {
  matrix temp;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) {
      temp.m[i][j] = 0;
      for (int k = 1; k <= n; ++k)
        (temp.m[i][j] += x.m[i][k] * y.m[k][j]) %= mod;
    }
  return temp;
}
void quick_mod(long long p) {
  for (; p; p >>= 1, ret = multi(ret, ret))
    if (p & 1) ans = multi(ans, ret);
}
bool check(long long x, long long y) {
  long long temp = x ^ y;
  long long cnt = 0;
  while (temp) {
    cnt += temp & 1;
    temp = temp >> 1;
  }
  return (cnt % 3 == 0);
}
int main(void) {
  scanf("%d%lld", &n, &k);
  for (int i = 1; i <= n; ++i) scanf("%lld", &a[i]);
  if (k == 1) {
    printf("%d\n", n);
    return 0;
  }
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j)
      if (check(a[i], a[j])) ret.m[i][j] = 1;
  for (int i = 1; i <= n; ++i) ans.m[i][i] = 1;
  quick_mod(k - 1);
  long long cnt = 0;
  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= n; ++j) (cnt += ans.m[i][j]) %= mod;
  printf("%lld\n", cnt);
  return 0;
}
