#include <bits/stdc++.h>
using namespace std;
const int N = 105;
long long mod = 1e9 + 7;
long long n, k;
long long xy[N];
long long a[N][N], v[N][N];
void mul(long long x[N][N], long long y[N][N], int n) {
  long long res[N][N];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) res[i][j] = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < n; k++)
        res[i][j] = (res[i][j] + (x[i][k] * y[k][j]) % mod) % mod;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) x[i][j] = res[i][j];
}
int main() {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> xy[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      a[i][j] = __builtin_popcountll(xy[i] ^ xy[j]) % 3 == 0;
  for (int i = 0; i < n; i++) v[i][i] = 1;
  k--;
  while (k) {
    if (k & 1) mul(v, a, n);
    mul(a, a, n);
    k /= 2;
  }
  long long ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) ans = (ans + v[i][j]) % mod;
  cout << ans;
}
