#include <bits/stdc++.h>
using namespace std;
int a[2001], b[2001], n, k, len = 0, ans = 0, res = 0;
void solve() {
  scanf("%d %d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    if (a[i] + k <= 5) {
      len++;
    }
  }
  ans = (len / 3);
  printf("%d", ans);
}
int main() { solve(); }
